Compare commits

...

15 Commits

Author SHA1 Message Date
0ed3f740b7 read/write docm 2017-08-16 18:05:59 +03:00
af2e76aea6 OdfFormatWriter - fix convert notes 2017-08-16 16:21:19 +03:00
6593230d48 . 2017-08-15 19:56:00 +03:00
e02c72b564 x2t version up. read/write xlsm. 2017-08-15 17:23:17 +03:00
c2964f92af . 2017-08-15 16:10:34 +03:00
15fb3a4f4e Revert "."
This reverts commit cff1836571.
2017-08-15 16:09:09 +03:00
cff1836571 . 2017-08-15 16:08:40 +03:00
cb57db3c8a . 2017-08-15 16:05:27 +03:00
d22fb105b6 OoxFormat - vbaProject, ... 2017-08-15 15:18:28 +03:00
89aba918bc OoxFormat - read/write vbaProject in binary 2017-08-14 19:24:21 +03:00
47c1e6f637 Merge branch 'develop' of github.com:ONLYOFFICE/core into develop 2017-08-14 16:36:45 +03:00
f5284c967b . 2017-08-14 16:32:41 +03:00
d465e29a0f v4.4.3 2017-08-14 16:30:52 +03:00
f43ef621cb OoxFormat - add vba & activeX controls 2017-08-14 16:26:30 +03:00
89ce79dafc v4.4.2 2017-07-24 15:25:00 +03:00
62 changed files with 1356 additions and 293 deletions

View File

@ -107,7 +107,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\_WORK\trunk\ServerComponents\Common\DocxFormat\Source\XML\libxml2\XML\include"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -40,11 +40,11 @@ namespace Writers
class DocumentWriter : public ContentWriter
{
XmlUtils::CStringWriter m_oWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
std::wstring m_sDir;
public:
DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
std::wstring m_sDir;
DocumentWriter( std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir), m_oHeaderFooterWriter(oHeaderFooterWriter)
{
}
void Write()

View File

@ -31,7 +31,9 @@
*/
#ifndef FILE_WRITER
#define FILE_WRITER
#include "../../DesktopEditor/common/Path.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "NumberingWriter.h"
#include "fontTableWriter.h"
@ -75,6 +77,8 @@ namespace Writers
DocumentRelsWriter m_oDocumentRelsWriter;
WebSettingsWriter m_oWebSettingsWriter;
DefaultThemeWriter m_oTheme;
smart_ptr<OOX::VbaProject> m_pVbaProject;
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
bool m_bSaveChartAsImg;

View File

@ -34,6 +34,30 @@
namespace BinDocxRW {
int Binary_VbaProjectTableReader::Read()
{
return ReadTable(&Binary_VbaProjectTableReader::ReadContent, this);
}
int Binary_VbaProjectTableReader::ReadContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerVbaProjectTypes::Name == type )
{
std::wstring file_name = m_oBufferedStream.GetString4(length);
OOX::CPath inputPath = m_oBufferedStream.m_strFolder + FILE_SEPARATOR_STR + L"media" + FILE_SEPARATOR_STR + file_name;
OOX::CPath outputPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"vbaProject.bin";
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
m_oFileWriter.m_pVbaProject->set_filename(outputPath.GetPath());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
//-------------------------------------------------------------------------------------
Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments)
{
}
@ -93,9 +117,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
}

View File

@ -273,6 +273,21 @@ private:
return res;
}
};
class Binary_VbaProjectTableReader : public Binary_CommonReader<Binary_VbaProjectTableReader>
{
Writers::FileWriter& m_oFileWriter;
public:
Binary_VbaProjectTableReader (NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Read ();
int ReadContent (BYTE type, long length, void* poResult);
};
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
{
Writers::FileWriter& m_oFileWriter;
@ -282,12 +297,12 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe
int nCurHeaderType;
public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public:
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
int Read();
int ReadHdrFtrContent(BYTE type, long length, void* poResult);
int ReadHdrFtrFEO(BYTE type, long length, void* poResult);
int ReadHdrFtrItem(BYTE type, long length, void* poResult);
int ReadHdrFtrContent (BYTE type, long length, void* poResult);
int ReadHdrFtrFEO (BYTE type, long length, void* poResult);
int ReadHdrFtrItem (BYTE type, long length, void* poResult);
int ReadHdrFtrItemContent(BYTE type, long length, void* poResult);
};
class Binary_rPrReader : public Binary_CommonReader<Binary_rPrReader>
@ -551,7 +566,7 @@ public:
std::wstring strXml;
HRESULT hRes = m_oFileWriter.m_pDrawingConverter->GetRecordXml(nCurPos, length, XMLWRITER_RECORD_TYPE_TEXT_FILL, XMLWRITER_DOC_TYPE_WORDART, strXml);
if (S_OK == hRes)
orPr->Fill = _T("<w14:textFill>") + strXml + _T("</w14:textFill>");
orPr->Fill = L"<w14:textFill>" + strXml + L"</w14:textFill>";
m_oBufferedStream.Seek(nCurPos + length);
}
}
@ -560,35 +575,35 @@ public:
{
TrackRevision oDel;
oBinary_CommonReader2.ReadTrackRevision(length, &oDel);
orPr->Del = oDel.ToString(_T("w:del"));
orPr->Del = oDel.ToString(L"w:del");
}
break;
case c_oSerProp_rPrType::Ins:
{
TrackRevision oIns;
oBinary_CommonReader2.ReadTrackRevision(length, &oIns);
orPr->Ins = oIns.ToString(_T("w:ins"));
orPr->Ins = oIns.ToString(L"w:ins");
}
break;
case c_oSerProp_rPrType::MoveFrom:
{
TrackRevision oMoveFrom;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom"));
orPr->MoveFrom = oMoveFrom.ToString(L"w:moveFrom");
}
break;
case c_oSerProp_rPrType::MoveTo:
{
TrackRevision oMoveTo;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo"));
orPr->MoveTo = oMoveTo.ToString(L"w:moveTo");
}
break;
case c_oSerProp_rPrType::rPrChange:
{
TrackRevision oRPrChange;
res = Read1(length, &Binary_rPrReader::ReadrPrChange, this, &oRPrChange);
orPr->rPrChange = oRPrChange.ToString(_T("w:rPrChange"));
orPr->rPrChange = oRPrChange.ToString(L"w:rPrChange");
}
break;
default:
@ -647,9 +662,9 @@ public:
{
BYTE contextualSpacing = m_oBufferedStream.GetUChar();
if(0 != contextualSpacing)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"true\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"true\"/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::Ind:
{
@ -657,9 +672,9 @@ public:
res = Read2(length, &Binary_pPrReader::ReadInd, this, &oTempWriter);
if(oTempWriter.GetCurSize() > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:ind")));
pCStringWriter->WriteString(std::wstring(L"<w:ind"));
pCStringWriter->Write(oTempWriter);
pCStringWriter->WriteString(std::wstring(_T("/>")));
pCStringWriter->WriteString(std::wstring(L"/>"));
}
break;
}
@ -668,35 +683,35 @@ public:
BYTE jc = m_oBufferedStream.GetUChar();
switch(jc)
{
case align_Right: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"right\" />")));break;
case align_Left: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"left\" />")));break;
case align_Center: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"center\" />")));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"both\" />")));break;
case align_Right: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"right\" />"));break;
case align_Left: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"left\" />"));break;
case align_Center: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"center\" />"));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"both\" />"));break;
}
}break;
case c_oSerProp_pPrType::KeepLines:
{
BYTE KeepLines = m_oBufferedStream.GetUChar();
if(0 != KeepLines)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepLines/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepLines w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::KeepNext:
{
BYTE KeepNext = m_oBufferedStream.GetUChar();
if(0 != KeepNext)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepNext/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepNext w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::PageBreakBefore:
{
BYTE pageBreakBefore = m_oBufferedStream.GetUChar();
if(0 != pageBreakBefore)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore/>")));
pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore w:val=\"false\"/>"));
break;
}
case c_oSerProp_pPrType::Spacing:
@ -705,7 +720,7 @@ public:
res = Read2(length, &Binary_pPrReader::ReadSpacing, this, &oSpacing);
if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
{
pCStringWriter->WriteString(std::wstring(_T("<w:spacing")));
pCStringWriter->WriteString(std::wstring(L"<w:spacing"));
BYTE bLineRule = linerule_Auto;
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
if(oSpacing.bLine)
@ -745,9 +760,9 @@ public:
if(oSpacing.bAfterAuto)
{
if(true == oSpacing.AfterAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"1\""));
else
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"0\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"0\""));
}
if(oSpacing.bBefore)
{
@ -758,11 +773,11 @@ public:
if(oSpacing.bBeforeAuto)
{
if(true == oSpacing.BeforeAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"1\""));
else
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"0\"")));
pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"0\""));
}
pCStringWriter->WriteString(std::wstring(_T("/>")));
pCStringWriter->WriteString(std::wstring(L"/>"));
}
break;
}
@ -776,7 +791,7 @@ public:
}
else
{
std::wstring sShd(_T("<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>"));
std::wstring sShd(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>");
pCStringWriter->WriteString(sShd);
}
break;
@ -787,10 +802,10 @@ public:
if(0 != WidowControl)
{
if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl/>")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl/>"));
}
else
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl w:val=\"off\" />")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl w:val=\"off\" />"));
break;
}
case c_oSerProp_pPrType::Tab:
@ -800,7 +815,7 @@ public:
size_t nLen = oTabs.m_aTabs.size();
if(nLen > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:tabs>")));
pCStringWriter->WriteString(std::wstring(L"<w:tabs>"));
for(size_t i = 0; i < nLen; ++i)
{
Tab& oTab = oTabs.m_aTabs[i];
@ -808,14 +823,14 @@ public:
std::wstring sVal;
switch(oTab.Val)
{
case g_tabtype_right: sVal=_T("right"); break;
case g_tabtype_center: sVal=_T("center"); break;
case g_tabtype_clear: sVal=_T("clear"); break;
default: sVal=_T("left"); break;
case g_tabtype_right: sVal = L"right"; break;
case g_tabtype_center: sVal = L"center"; break;
case g_tabtype_clear: sVal = L"clear"; break;
default: sVal = L"left"; break;
}
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"/>");
}
pCStringWriter->WriteString(std::wstring(_T("</w:tabs>")));
pCStringWriter->WriteString(std::wstring(L"</w:tabs>"));
}
}break;
case c_oSerProp_pPrType::ParaStyle:
@ -826,9 +841,9 @@ public:
}break;
case c_oSerProp_pPrType::numPr:
{
pCStringWriter->WriteString(std::wstring(_T("<w:numPr>")));
pCStringWriter->WriteString(std::wstring(L"<w:numPr>"));
res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:numPr>")));
pCStringWriter->WriteString(std::wstring(L"</w:numPr>"));
}break;
case c_oSerProp_pPrType::pPr_rPr:
{
@ -2917,7 +2932,8 @@ class Binary_OtherTableReader : public Binary_CommonReader<Binary_OtherTableRead
Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir;
public:
Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):m_sFileInDir(sFileInDir),Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter)
Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: m_sFileInDir(sFileInDir), Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Read()
@ -7022,13 +7038,13 @@ public:
{
if(false == m_oFileWriter.m_bSaveChartAsImg)
{
OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("charts");
OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"charts";
OOX::CSystemUtility::CreateDirectories(pathChartsDir.GetPath());
OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + FILE_SEPARATOR_STR + _T("_rels");
OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + FILE_SEPARATOR_STR + L"_rels";
OOX::CSystemUtility::CreateDirectories(pathChartsRelsDir.GetPath());
OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("embeddings");
OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"embeddings";
OOX::CSystemUtility::CreateDirectories(pathChartsWorksheetDir.GetPath());
int nativeDocumentType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType;
@ -7922,9 +7938,9 @@ public:
int res = ReadTable(&Binary_NotesTableReader::ReadNotes, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + sFilename + _T(".rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
return res;
@ -7961,33 +7977,33 @@ public:
XmlUtils::CStringWriter& writer = pBinary_DocumentTableReader->m_oDocumentWriter.m_oContent;
if(m_bIsFootnote)
{
writer.WriteString(_T("<w:footnote"));
writer.WriteString(L"<w:footnote");
}
else
{
writer.WriteString(_T("<w:endnote"));
writer.WriteString(L"<w:endnote");
}
if(m_oType.IsInit())
{
writer.WriteString(_T(" w:type=\""));
writer.WriteString(L" w:type=\"");
writer.WriteString(m_oType->ToString());
writer.WriteString(_T("\""));
writer.WriteString(L"\"");
}
if(m_oId.IsInit())
{
writer.WriteString(_T(" w:id=\""));
writer.WriteString(L" w:id=\"");
writer.WriteString(m_oId->ToString());
writer.WriteString(_T("\""));
writer.WriteString(L"\"");
}
writer.WriteString(_T(">"));
writer.WriteString(L">");
res = Read1(length, &Binary_NotesTableReader::ReadNoteContent, this, poResult);
if(m_bIsFootnote)
{
writer.WriteString(_T("</w:footnote>"));
writer.WriteString(L"</w:footnote>");
}
else
{
writer.WriteString(_T("</w:endnote>"));
writer.WriteString(L"</w:endnote>");
}
}
else
@ -8087,8 +8103,8 @@ public:
}
else
{
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<w:defaultTabStop w:val=\"708\"/>"));
std::wstring sClrMap(_T("<w:clrSchemeMapping w:bg1=\"light1\" w:t1=\"dark1\" w:bg2=\"light2\" w:t2=\"dark2\" w:accent1=\"accent1\" w:accent2=\"accent2\" w:accent3=\"accent3\" w:accent4=\"accent4\" w:accent5=\"accent5\" w:accent6=\"accent6\" w:hyperlink=\"hyperlink\" w:followedHyperlink=\"followedHyperlink\"/>"));
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:defaultTabStop w:val=\"708\"/>");
std::wstring sClrMap(L"<w:clrSchemeMapping w:bg1=\"light1\" w:t1=\"dark1\" w:bg2=\"light2\" w:t2=\"dark2\" w:accent1=\"accent1\" w:accent2=\"accent2\" w:accent3=\"accent3\" w:accent4=\"accent4\" w:accent5=\"accent5\" w:accent6=\"accent6\" w:hyperlink=\"hyperlink\" w:followedHyperlink=\"followedHyperlink\"/>");
m_oFileWriter.m_oSettingWriter.AddSetting(sClrMap);
m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap);
}
@ -8140,9 +8156,12 @@ public:
case c_oSerTableTypes::Endnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
break;
case c_oSerTableTypes::VbaProject:
res = Binary_VbaProjectTableReader(m_oBufferedStream, m_oFileWriter).Read();
break;
//Comments должны читаться раньше чем c_oSerTableTypes::Document
//case c_oSerTableTypes::Comments:
//case c_oSerTableTypes::Comments
// res = oBinary_CommentsTableReader.Read();
// break;
//case c_oSerTableTypes::Other:
@ -8165,7 +8184,18 @@ public:
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", L"fontTable.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", L"theme/theme1.xml",L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word", L"document.xml");
if (m_oFileWriter.m_pVbaProject.IsInit())
{
//m_oFileWriter.m_pVbaProject->write();
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2006/relationships/vbaProject", L"vbaProject.bin", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.ms-word.document.macroEnabled.main+xml", L"/word", L"document.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.ms-office.vbaProject", L"/word", L"vbaProject.bin");
}
else
{
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word", L"document.xml");
}
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", L"/word", L"styles.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", L"/word", L"settings.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", L"/word", L"webSettings.xml");
@ -8175,19 +8205,19 @@ public:
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering")), std::wstring(_T("numbering.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", L"numbering.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml");
}
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes")), std::wstring(_T("footnotes.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", L"footnotes.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml");
}
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes")), std::wstring(_T("endnotes.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", L"endnotes.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml");
}
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i)
@ -8196,7 +8226,7 @@ public:
if(false == pHeader->IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header")), pHeader->m_sFilename, std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", pHeader->m_sFilename, std::wstring(), &rId);
pHeader->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", L"/word", pHeader->m_sFilename);
@ -8208,7 +8238,7 @@ public:
if(false == pFooter->IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer")), pFooter->m_sFilename, std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", pFooter->m_sFilename, std::wstring(), &rId);
pFooter->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename);
@ -8216,9 +8246,9 @@ public:
}
res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read();
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word")
+ FILE_SEPARATOR_STR + _T("_rels")
+ FILE_SEPARATOR_STR + _T("document.xml.rels");
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"
+ FILE_SEPARATOR_STR + L"_rels"
+ FILE_SEPARATOR_STR + L"document.xml.rels";
CComments& oComments= oBinary_CommentsTableReader.m_oComments;
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
@ -8232,19 +8262,19 @@ public:
if(false == oCommentsWriter.m_sComment.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments")), std::wstring(_T("comments.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
}
if(false == oCommentsWriter.m_sCommentExt.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/commentsExtended")), std::wstring(_T("commentsExtended.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
}
if(false == oCommentsWriter.m_sPeople.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/people")), std::wstring(_T("people.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
}

View File

@ -142,19 +142,20 @@ extern int g_nCurFormatVersion;
};}
namespace c_oSerTableTypes{enum c_oSerTableTypes
{
Signature = 0,
Info = 1,
Media = 2,
Numbering = 3,
HdrFtr = 4,
Style = 5,
Document = 6,
Other = 7,
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11,
Background
Signature = 0,
Info = 1,
Media = 2,
Numbering = 3,
HdrFtr = 4,
Style = 5,
Document = 6,
Other = 7,
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11,
Background = 12,
VbaProject = 13
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{
@ -203,10 +204,10 @@ extern int g_nCurFormatVersion;
};}
namespace c_oSerOtherTableTypes{enum c_oSerOtherTableTypes
{
ImageMap = 0,
ImageMap_Src = 1,
EmbeddedFonts = 2,
DocxTheme = 3
ImageMap = 0,
ImageMap_Src = 1,
EmbeddedFonts = 2,
DocxTheme = 3
};}
namespace c_oSerFontsTypes{enum c_oSerFontsTypes
{
@ -521,6 +522,10 @@ extern int g_nCurFormatVersion;
endnoteReference = 27,
arPr = 28
};}
namespace c_oSerVbaProjectTypes{enum c_oSerVbaProjectType
{
Name = 0
};}
namespace c_oSerBackgroundType{enum c_oSerBackgroundType
{
Color = 0,

View File

@ -82,11 +82,11 @@ namespace BinDocxRW
int m_nType;
public:
std::wstring m_sFld;
public: FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
public: int GetType()
{
return m_nType;
}
FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
int GetType()
{
return m_nType;
}
};
class BinaryCommonWriter
{
@ -3027,6 +3027,26 @@ namespace BinDocxRW
}
pOfficeDrawingConverter->SetRels(oldRels);
}
void WriteVbaProjectContent(OOX::VbaProject& oVbaProject)
{
std::wstring file_name = oVbaProject.filename().GetFilename();
m_oBcw.m_oStream.WriteBYTE(c_oSerVbaProjectTypes::Name);
m_oBcw.m_oStream.WriteStringW(file_name);
//... todooo write parsing vba project
//write vbaData.... todooo
//copy file bin
oVbaProject.copy_to(m_oBcw.m_oStream.m_pCommon->m_pImageManager->m_strDstMedia);
}
void WriteVbaProject(OOX::VbaProject& oVbaProject)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteVbaProjectContent(oVbaProject);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void Write(std::vector<OOX::WritingElement*>& aElems)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
@ -7866,9 +7886,8 @@ namespace BinDocxRW
//Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
@ -7876,7 +7895,15 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if(NULL != oDocx.m_pVbaProject)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
// Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
this->WriteTableEnd(nCurPos);

View File

@ -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);

View File

@ -78,6 +78,7 @@ public:
std::wstring name;
std::wstring location_ref;
std::wstring source_ref;
std::wstring source_table_name;
std::vector<_field> fields;
std::vector<int> row_fields;
std::vector<int> page_fields;
@ -86,6 +87,7 @@ public:
}current_;
void serialize_view(std::wostream & strm);
void serialize_cache(std::wostream & strm);
};
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
@ -217,6 +219,96 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
}
}
void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotCacheDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//{ records file
// CP_XML_ATTR(L"r:id", L"rId1" );
//}
CP_XML_ATTR(L"enableRefresh", 1);
//CP_XML_ATTR(L"refreshedBy", db->rgb.value());
//CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
CP_XML_ATTR(L"recordCount", 0);
//createdVersion="1"
//refreshedVersion="2"
//upgradeOnRefresh="1">
if (true)
{
CP_XML_NODE(L"cacheSource")
{
CP_XML_ATTR(L"type", L"worksheet");
CP_XML_NODE(L"worksheetSource")
{
CP_XML_ATTR(L"ref", current_.source_ref);
CP_XML_ATTR(L"sheet", current_.source_table_name);
}
}
}
if (current_.fields.empty() == false)
{
CP_XML_NODE(L"cacheFields")
{
CP_XML_ATTR(L"count", current_.fields.size());
for (size_t i = 0; i < current_.fields.size(); i++)
{
CP_XML_NODE(L"cacheField")
{
CP_XML_ATTR(L"name", current_.fields[i].name);
CP_XML_ATTR(L"numFmtId", 0);
if (current_.fields[i].caches.empty() == false)
{
CP_XML_NODE(L"sharedItems")
{
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
//CP_XML_ATTR(L"containsSemiMixedTypes", );
CP_XML_ATTR(L"containsNonDate", 1);
CP_XML_ATTR(L"containsDate", 0);
CP_XML_ATTR(L"containsBlank", 0);
//CP_XML_ATTR(L"containsString", );
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
{
std::wstring node_name = L"s";
//switch(current_.fields[i].caches[j].type)
//{
//}
CP_XML_NODE(node_name)
{
CP_XML_ATTR(L"v", current_.fields[i].caches[j]);
}
}
}
}
}
}
}
}
//if (pivot_cache->m_arSXFORMULA.empty() == false)
//{
// CP_XML_NODE(L"calculatedItems")
// {
// CP_XML_ATTR(L"count", pivot_cache->m_arSXFORMULA.size());
// for (size_t i = 0; i < pivot_cache->m_arSXFORMULA.size(); i++)
// {
// pivot_cache->m_arSXFORMULA[i]->serialize(CP_XML_STREAM());
// }
// }
//}
}
}
}
int xlsx_pivots_context::get_count()
{
return (int)impl_->pivot_xmls_.size();
@ -278,6 +370,7 @@ int xlsx_pivots_context::end_table()
std::wstringstream rec_strm;
impl_->serialize_view(view_strm);
impl_->serialize_cache(cache_strm);
Impl::_pivot_xml v = {cache_strm.str(), rec_strm.str(), view_strm.str()};
@ -340,9 +433,10 @@ void xlsx_pivots_context::end_field()
{
}
void xlsx_pivots_context::set_source_range(std::wstring ref)
void xlsx_pivots_context::set_source_range(std::wstring table_name, std::wstring ref)
{
impl_->current_.source_ref = ref;
impl_->current_.source_table_name = table_name;
impl_->current_.source_ref = ref;
}
void xlsx_pivots_context::add_connections(std::wstring connections)

View File

@ -63,7 +63,7 @@ public:
void set_view_name(std::wstring name);
void set_view_target_range(std::wstring ref);
void set_source_range(std::wstring ref);
void set_source_range(std::wstring table_name, std::wstring ref);
void write_cache_definitions_to (int index, std::wostream & strm);
void write_cache_records_to (int index, std::wostream & strm);

View File

@ -93,6 +93,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
Context.get_pivots_context().start_table();
source_->xlsx_convert(Context);
if (table_name_) Context.get_pivots_context().set_view_name(*table_name_);
if (table_target_range_address_)
{
@ -106,7 +108,6 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
Context.get_pivots_context().set_view_target_range(ref);
//Context.get_pivots_context().set_view_target_table(table_index);
}
source_->xlsx_convert(Context);
for (size_t i = 0; i < fields_.size(); i++)
{
@ -239,7 +240,7 @@ const wchar_t * table_source_cell_range::name = L"source-cell-range";
void table_source_cell_range::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:cellrange-address", table_cellrange_address_);
CP_APPLY_ATTR(L"table:cell-range-address", table_cell_range_address_);
}
void table_source_cell_range::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -248,14 +249,14 @@ void table_source_cell_range::add_child_element( xml::sax * Reader, const std::w
}
void table_source_cell_range::xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (table_cellrange_address_)
if (table_cell_range_address_)
{
formulasconvert::odf2oox_converter formulas_converter;
std::wstring ref = formulas_converter.convert_named_ref(*table_cellrange_address_, false);
std::wstring ref = formulas_converter.convert_named_ref(*table_cell_range_address_, false);
std::wstring table_name = formulas_converter.get_table_name();
Context.get_pivots_context().set_source_range(ref);
Context.get_pivots_context().set_source_range(table_name, ref);
}
}
//-------------------------------------------------------------------------------------------------

View File

@ -247,7 +247,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
_CP_OPT(std::wstring) table_cellrange_address_;
_CP_OPT(std::wstring) table_cell_range_address_;
office_element_ptr_array content_; //filters
};

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;&quot;../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories="../include;&quot;../../DesktopEditor/freetype-2.5.2/include&quot;;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
AdditionalIncludeDirectories="../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/xml/build/vs2005"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="OdfFileWriterTest"
ProjectGUID="{FBA8446A-150F-4A10-B4DA-1022048D6473}"
RootNamespace="ASCOfficeOdfFileWTest"
@ -43,6 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/xml/build/vs2005"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -1345,6 +1345,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{
if (pShape->nvSpPr.nvPr.ph.is_init())
{
if (type == Notes || type == NotesMaster)
{
pShape->nvSpPr.nvPr.ph->idx.reset();
}
if (bFillUp)
pShape->FillLevelUp();

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../ASCOfficeOdfFile/include;../../../ASCOfficeOdfFile/src/odf/datatypes;&quot;../../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories="../../../ASCOfficeOdfFile/include;../../../ASCOfficeOdfFile/src/odf/datatypes;../../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_LIB;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -55,7 +55,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -134,7 +134,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -36,8 +36,10 @@
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/Base64.h"

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include "Path.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
#include "../../../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
namespace NSPresentationEditor
{

View File

@ -31,10 +31,7 @@
*/
#include "FileFactory.h"
#include "../../Common/DocxFormat/Source/DocxFormat/File.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Rels.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "FileMap.h"
#include "FileTypes.h"
#include "App.h"
@ -54,6 +51,8 @@
#include "NotesMaster.h"
#include "LegacyDiagramText.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Rels.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
@ -62,13 +61,14 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalVideo.h"
#include "../../Common/DocxFormat/Source/DocxFormat/UnknowTypeFile.h"
#include "FileMap.h"
//
namespace PPTX

View File

@ -30,6 +30,10 @@
*
*/
#pragma once
#ifndef PPTX_FILEFACTORY_PPTX_INCLUDE_H_
#define PPTX_FILEFACTORY_PPTX_INCLUDE_H_
#include "../../Common/DocxFormat/Source/DocxFormat/File.h"
namespace OOX {namespace Rels {class CRelationShip;}}
@ -44,3 +48,4 @@ namespace PPTX
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, OOX::Rels::CRelationShip& relation, FileMap& map);
};
} // namespace PPTX
#endif // PPTX_FILEFACTORY_PPTX_INCLUDE_H_

View File

@ -32,7 +32,6 @@
#pragma once
#include "../../../../Common/DocxFormat/Source/DocxFormat/File.h"
#include "../../../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
#include "Logic/TextParagraphPr.h"

View File

@ -44,6 +44,7 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
@ -367,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);

View File

@ -42,6 +42,8 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
namespace PPTX
{
namespace Logic

View File

@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\Common\ASCDocxFormat\Source\Utility;..\..\Common\ASCDocxFormat\Source\XML;..\..\Common\ASCDocxFormat\Source\;.\;..\..\Common\DocxFormat\Source\XML\libxml2\XML\include;&quot;../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories="&quot;../../DesktopEditor/freetype-2.5.2/include&quot;;../../DesktopEditor/xml/build/vs2005"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -112,7 +112,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\Common\DocxFormat\Source\XML\libxml2\XML\include;&quot;..\..\DesktopEditor\freetype-2.5.2\include&quot;"
AdditionalIncludeDirectories="&quot;..\..\DesktopEditor\freetype-2.5.2\include&quot;"
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;NODOCX;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;_AVS_PPT_SHAPE_INCLUDE_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;BUILD_CONFIG_FULL_VERSION;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -33,9 +33,9 @@
#include "OOXMathReader.h"
#include "OOXParagraphReader.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/OMath.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/OMath.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h"
bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement * ooxMath, RtfMathPtr & rtfMath)
{

View File

@ -35,7 +35,7 @@
#include "../RtfMath.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
class OOXMathReader
{

View File

@ -32,12 +32,12 @@
#include "OOXShapeReader.h"
#include "OOXTextItemReader.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h"
#include "../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/Shape.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h"
#include "../../../ASCOfficeOdfFile/src/odf/svg_parser.h"
#include "../../../../ASCOfficeOdfFile/src/odf/svg_parser.h"
#include <boost/algorithm/string.hpp>
#ifndef RGB

View File

@ -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);

View File

@ -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);

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;&quot;D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -107,7 +107,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;&quot;D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\..\Source\XML\libxml2\XML\include;.\..\Source\Utility;.\..\Source\XML;.\..\Source\Common;..\..\..\..\..\Redist;..\..\..\..\..\..\ASCOfficeOdtFile\Source\OfficeSvmFile;.\..\Source\Base;.\..\Source\SystemUtility"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -111,7 +111,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\..\Source\XML\libxml2\XML\include"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -1183,6 +1183,10 @@
<Filter
Name="Media"
>
<File
RelativePath="..\Source\DocxFormat\Media\ActiveX.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Media\Audio.h"
>
@ -1199,6 +1203,10 @@
RelativePath="..\Source\DocxFormat\Media\OleObject.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Media\VbaProject.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Media\Video.h"
>
@ -1514,6 +1522,10 @@
RelativePath="..\Source\XlsxFormat\Drawing\CellAnchor.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Controls\Controls.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Drawing.h"
>
@ -1522,10 +1534,6 @@
RelativePath="..\Source\XlsxFormat\Drawing\FromTo.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Ole\oleobjects.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Pos.h"
>

View File

@ -201,9 +201,12 @@ namespace OOX
public:
CDocument()
{
m_bMacroEnabled = false;
}
CDocument(const CPath& oRootPath, const CPath& oPath)
{
m_bMacroEnabled = false;
read( oRootPath, oPath );
}
virtual ~CDocument()
@ -218,7 +221,6 @@ namespace OOX
m_arrItems.clear();
}
public:
virtual void read(const CPath& oPath)
{
@ -317,7 +319,11 @@ namespace OOX
{
m_oReadPath = oPath;
IFileContainer::Read( oRootPath, oPath );
if (IFileContainer::IsExist(OOX::FileTypes::VbaProject))
{
m_bMacroEnabled = true;
}
#ifdef USE_LITE_READER
Common::readAllShapeTypes(oPath, m_arrShapeTypes);
@ -491,7 +497,8 @@ namespace OOX
}
virtual const OOX::FileType type() const
{
return FileTypes::Document;
if (m_bMacroEnabled) return FileTypes::DocumentMacro;
else return FileTypes::Document;
}
virtual const CPath DefaultDirectory() const
{
@ -634,6 +641,7 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
public:
bool m_bMacroEnabled;
CPath m_oReadPath;
// Attributes
SimpleTypes::CConformanceClass<SimpleTypes::conformanceclassTransitional> m_oConformance;

View File

@ -43,100 +43,80 @@ namespace OOX {
// Ищем основной документ
smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document);
if (pFile.IsInit() && OOX::FileTypes::Document == pFile->type())
m_pDocument = (OOX::CDocument*)pFile.operator->();
else
m_pDocument = NULL;
if (pFile.IsInit() == false)
{
pFile = Find(OOX::FileTypes::DocumentMacro);
}
if (pFile.IsInit())
m_pDocument = dynamic_cast<OOX::CDocument*>(pFile.operator->());
if ( m_pDocument )
{
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
// Ищем таблицу шрифтов
pFile = pDocumentContainer->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() && OOX::FileTypes::FontTable == pFile->type() )
m_pFontTable = (OOX::CFontTable*)pFile.operator->();
else
m_pFontTable = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() )
m_pFontTable = dynamic_cast<OOX::CFontTable*>(pFile.operator->());
// Ищем таблицу нумераций
pFile = pDocumentContainer->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit() && OOX::FileTypes::Numbering == pFile->type() )
m_pNumbering = (OOX::CNumbering*)pFile.operator->();
else
m_pNumbering = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit())
m_pNumbering = dynamic_cast<OOX::CNumbering*>(pFile.operator->());
// Ищем таблицу стилей
pFile = pDocumentContainer->Find( OOX::FileTypes::Style );
if ( pFile.IsInit() && OOX::FileTypes::Style == pFile->type() )
m_pStyles = (OOX::CStyles*)pFile.operator->();
else
m_pStyles = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Style );
if ( pFile.IsInit())
m_pStyles = dynamic_cast<OOX::CStyles*>(pFile.operator->());
// Ищем сноски для страниц
pFile = pDocumentContainer->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit() && OOX::FileTypes::FootNote == pFile->type() )
m_pFootnotes = (OOX::CFootnotes*)pFile.operator->();
else
m_pFootnotes = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit())
m_pFootnotes = dynamic_cast<OOX::CFootnotes*>(pFile.operator->());
pFile = pDocumentContainer->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit() && OOX::FileTypes::EndNote == pFile->type() )
m_pEndnotes = (OOX::CEndnotes*)pFile.operator->();
else
m_pEndnotes = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit())
m_pEndnotes = dynamic_cast<OOX::CEndnotes*>(pFile.operator->());
// Ищем файл с наройками
pFile = pDocumentContainer->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() && OOX::FileTypes::Setting == pFile->type() )
m_pSettings = (OOX::CSettings*)pFile.operator->();
else
m_pSettings = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() )
m_pSettings = dynamic_cast<OOX::CSettings*>(pFile.operator->());
// Ищем файл с комментариями
pFile = pDocumentContainer->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit() && OOX::FileTypes::Comments == pFile->type() )
m_pComments = (OOX::CComments*)pFile.operator->();
else
m_pComments = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit())
m_pComments = dynamic_cast<OOX::CComments*>(pFile.operator->());
// Ищем файл с комментариями Ext
pFile = pDocumentContainer->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit() && OOX::FileTypes::CommentsExt == pFile->type() )
m_pCommentsExt = (OOX::CCommentsExt*)pFile.operator->();
else
m_pCommentsExt = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit())
m_pCommentsExt = dynamic_cast<OOX::CCommentsExt*>(pFile.operator->());
// Ищем файл с авторами
pFile = pDocumentContainer->Find( OOX::FileTypes::People );
if ( pFile.IsInit() && OOX::FileTypes::People == pFile->type() )
m_pPeople = (OOX::CPeople*)pFile.operator->();
else
m_pPeople = NULL;
pFile = m_pDocument->Find( OOX::FileTypes::People );
if ( pFile.IsInit())
m_pPeople = dynamic_cast<OOX::CPeople*>(pFile.operator->());
//OOX::CRels rels(oFilePath / m_pDocument->DefaultDirectory() / m_pDocument->DefaultFileName());
//IFileContainer::Read(rels, oFilePath);
// Ищем файл с темами
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type())
m_pTheme = (PPTX::Theme*)pFile.operator->();
else
m_pTheme = NULL;
}
pFile = m_pDocument->Find(OOX::FileTypes::Theme);
if (pFile.IsInit())
m_pTheme = dynamic_cast<PPTX::Theme*>(pFile.operator->());
pFile = m_pDocument->Find(OOX::FileTypes::VbaProject);
if (pFile.IsInit())
m_pVbaProject = dynamic_cast<OOX::VbaProject*>(pFile.operator->());
}
// Ищем настройки
pFile = Find( OOX::FileTypes::App );
if ( pFile.IsInit() && OOX::FileTypes::App == pFile->type() )
m_pApp = (OOX::CApp*)pFile.operator->();
else
m_pApp = NULL;
if ( pFile.IsInit())
m_pApp = dynamic_cast<OOX::CApp*>(pFile.operator->());
pFile = Find( OOX::FileTypes::Core );
if ( pFile.IsInit() && OOX::FileTypes::Core == pFile->type() )
m_pCore = (OOX::CCore*)pFile.operator->();
else
m_pCore = NULL;
if ( pFile.IsInit())
m_pCore = dynamic_cast<OOX::CCore*>(pFile.operator->());
return true;
}

View File

@ -52,6 +52,8 @@
#include "External/HyperLink.h"
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
@ -81,6 +83,7 @@ namespace OOX
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
m_pVbaProject = NULL;
}
CDocx(const CPath& oFilePath)
{
@ -97,6 +100,7 @@ namespace OOX
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
m_pVbaProject = NULL;
Read( oFilePath );
}
@ -197,21 +201,22 @@ namespace OOX
return NULL;
}
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
OOX::CDocument *m_pDocument; // Основной документ word/document.xml
OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml
OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml
OOX::CStyles *m_pStyles; // Стили word/styles.xml
OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml
OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml
OOX::CSettings *m_pSettings; // Настройки word/settings.xml
OOX::CComments *m_pComments; // word/comments.xml
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml
OOX::CDocument *m_pDocument; // Основной документ word/document.xml
OOX::CFontTable *m_pFontTable; // Таблица шрифтов word/fonttable.xml
OOX::CNumbering *m_pNumbering; // Нумерации word/numbering.xml
OOX::CStyles *m_pStyles; // Стили word/styles.xml
OOX::CFootnotes *m_pFootnotes; // Сноски word/footnotes.xml
OOX::CEndnotes *m_pEndnotes; // Сноски word/endnotes.xml
OOX::CSettings *m_pSettings; // Настройки word/settings.xml
OOX::CComments *m_pComments; // word/comments.xml
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml
OOX::VbaProject *m_pVbaProject;
PPTX::Theme *m_pTheme;
PPTX::Theme *m_pTheme;
};
} // OOX

View File

@ -34,7 +34,6 @@
#define OOX_FILE_INCLUDE_H_
#include "../XML/XmlSimple.h"
#include "../SystemUtility/SystemUtility.h"
#include "FileType.h"
#include "ContentTypes.h"

View File

@ -44,9 +44,11 @@
#include "Footnote.h"
#include "Endnote.h"
#include "Media/Image.h"
#include "Media/ActiveX.h"
#include "Media/OleObject.h"
#include "Media/Audio.h"
#include "Media/Video.h"
#include "Media/VbaProject.h"
#include "External/HyperLink.h"
#include "External/ExternalVideo.h"
#include "External/ExternalAudio.h"
@ -73,7 +75,7 @@ namespace OOX
else
oFileName = oPath / oRelationFilename;
if ( oRelation.Type() == FileTypes::Document)
if ( oRelation.Type() == FileTypes::Document || oRelation.Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName ));
@ -136,6 +138,14 @@ namespace OOX
return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_xml)
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( oRootPath, oFileName));
else if ( oRelation.Type() == OOX::FileTypes::ActiveX_bin)
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
//else if ( oRelation.Type() == OOX::FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
@ -155,7 +165,7 @@ namespace OOX
return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( pRelation->Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
else if ( pRelation->Type() == FileTypes::Document)
else if ( pRelation->Type() == FileTypes::Document || pRelation->Type() == FileTypes::DocumentMacro)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Theme)
{
@ -220,6 +230,14 @@ namespace OOX
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
else if ( pRelation->Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::ActiveX_xml)
return smart_ptr<OOX::File>(new ActiveX_xml( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::ActiveX_bin)
return smart_ptr<OOX::File>(new ActiveX_bin( oFileName ));
else if ( pRelation->Type() == FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
//else if ( pRelation->Type() == FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}

View File

@ -52,6 +52,10 @@ namespace OOX
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType DocumentMacro (L"word", L"document.xml",
_T("application/vnd.ms-word.document.macroEnabled.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType Theme (L"theme", L"theme.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"), true);
@ -172,6 +176,22 @@ namespace OOX
_T("application/vnd.openxmlformats-officedocument.drawingml.chart+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"), true, true);
const FileType ActiveX_xml(L"activeX", L"",
_T("application/vnd.ms-office.activeX+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"));
const FileType ActiveX_bin(L"activeX", L"",
_T("application/vnd.ms-office.activeX"),
_T("http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"));
const FileType VbaProject(L"", L"vbaProject.bin",
_T("application/vnd.ms-office.vbaProject"),
_T("http://schemas.microsoft.com/office/2006/relationships/vbaProject"));
const FileType VbaData(L"", L"vbaData.xml",
_T("application/vnd.ms-word.vbaData+xml"),
_T("http://schemas.microsoft.com/office/2006/relationships/wordVbaData"));
const FileType MicrosoftOfficeUnknown(L"embeddings", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));

View File

@ -64,8 +64,6 @@ namespace OOX
m_arrFootnote.clear();
}
public:
virtual void read(const CPath& oPath)
{
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
@ -118,8 +116,6 @@ namespace OOX
oContent.Registration( type().OverrideType(), oDirectory, oPath );
IFileContainer::Write( oPath, oDirectory, oContent );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::FootNote;
@ -133,8 +129,6 @@ namespace OOX
return type().DefaultFileName();
}
public:
OOX::CFtnEdn* Find(const OOX::Logic::CFootnoteReference& oReference) const
{
if ( !oReference.m_oId.IsInit() )
@ -157,10 +151,9 @@ namespace OOX
return (unsigned int)m_arrFootnote.size();
}
public:
CPath m_oReadPath;
std::vector<OOX::CFtnEdn*> m_arrFootnote;
std::vector<std::wstring> m_arrShapeTypes;
std::vector<std::wstring> m_arrShapeTypes;
};
} // namespace OOX

View File

@ -41,6 +41,8 @@
#include "External/HyperLink.h"
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h"
#include "../XlsxFormat/FileFactory_Spreadsheet.h"
@ -259,7 +261,21 @@ namespace OOX
return smart_ptr<HyperLink>();
return pPair->second.smart_dynamic_cast<HyperLink>();
}
smart_ptr<ActiveX_xml> IFileContainer::GetActiveX_xml(const RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
return smart_ptr<ActiveX_xml>();
return pPair->second.smart_dynamic_cast<ActiveX_xml>();
}
smart_ptr<ActiveX_bin> IFileContainer::GetActiveX_bin(const RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
return smart_ptr<ActiveX_bin>();
return pPair->second.smart_dynamic_cast<ActiveX_bin>();
}
smart_ptr<OleObject> IFileContainer::GetOleObject (const RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());

View File

@ -48,6 +48,8 @@ namespace OOX
class Image;
class HyperLink;
class OleObject;
class ActiveX_xml;
class ActiveX_bin;
}
namespace PPTX
@ -85,6 +87,8 @@ namespace OOX
virtual smart_ptr<Image> GetImage (const RId& rId) const;
virtual smart_ptr<HyperLink> GetHyperlink(const RId& rId) const;
virtual smart_ptr<OleObject> GetOleObject(const RId& rId) const;
virtual smart_ptr<ActiveX_xml> GetActiveX_xml(const RId& rId) const;
virtual smart_ptr<ActiveX_bin> GetActiveX_bin(const RId& rId) const;
virtual smart_ptr<PPTX::LegacyDiagramText> GetLegacyDiagramText (const OOX::RId& rId) const;
OOX::CRels* GetCurRls()

View File

@ -227,10 +227,9 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, (L"r:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType )
WritingElement_ReadAttributes_Read_if ( oReader, (L"r:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType )
WritingElement_ReadAttributes_End( oReader )
}

View File

@ -0,0 +1,239 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_ACTIVEX_INCLUDE_H_
#define OOX_ACTIVEX_INCLUDE_H_
#include "Media.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../IFileContainer.h"
namespace OOX
{
class COcxPr : public WritingElement
{
public:
WritingElement_AdditionConstructors(COcxPr)
COcxPr()
{
}
virtual ~COcxPr()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<ocxPr>"));
writer.WriteString(_T("</ocxPr>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_x_OcxPr;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start(oReader)
WritingElement_ReadAttributes_Read_if (oReader, _T("ax:name") , m_oName)
WritingElement_ReadAttributes_Read_else_if (oReader, _T("ax:value") , m_oValue)
WritingElement_ReadAttributes_End(oReader)
}
nullable<std::wstring> m_oName;
nullable<std::wstring> m_oValue;
//font
//picture
};
class ActiveX_xml : public File, public OOX::IFileContainer
{
public:
ActiveX_xml()
{
m_bDocument = false;
}
ActiveX_xml(const CPath& oRootPath, const CPath& filename)
{
m_bDocument = false;
read( oRootPath, filename );
}
virtual ~ActiveX_xml()
{
ClearItems();
}
void ClearItems()
{
for (size_t nIndex = 0; nIndex < m_arrOcxPr.size(); ++nIndex)
{
delete m_arrOcxPr[nIndex];
}
m_arrOcxPr.clear();
}
virtual void read(const CPath& oPath)
{
CPath oRootPath;
read(oRootPath, oPath);
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
m_oReadPath = oPath;
IFileContainer::Read( oRootPath, oPath );
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oPath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("ocx") == sName)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
{
int nDocumentDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nDocumentDepth ) )
{
sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("ocxPr") == sName )
{
COcxPr* pOcxPr = new COcxPr(oReader);
m_arrOcxPr.push_back(pOcxPr);
}
}
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start(oReader)
WritingElement_ReadAttributes_Read_if (oReader, L"ax:classid" , m_oClassId)
WritingElement_ReadAttributes_Read_else_if (oReader, L"ax:persistence" , m_oPersistence)
WritingElement_ReadAttributes_Read_else_if (oReader, L"r:id" , m_oId)
WritingElement_ReadAttributes_Read_else_if (oReader, L"ax:license" , m_oLicense)
WritingElement_ReadAttributes_End(oReader)
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
{
}
virtual const FileType type() const
{
return OOX::FileTypes::ActiveX_xml;
}
virtual const CPath DefaultDirectory() const
{
if (m_bDocument) return type().DefaultDirectory();
else return L"../" + type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
bool m_bDocument;
protected:
CPath m_oReadPath;
nullable<std::wstring> m_oClassId;
nullable<std::wstring> m_oLicense;
nullable<std::wstring> m_oPersistence; //(§3.6.2.1, ST_Persistence).
nullable<SimpleTypes::CRelationshipId > m_oId;
std::vector<OOX::COcxPr*> m_arrOcxPr;
};
class ActiveX_bin : public Media
{
public:
ActiveX_bin(bool bDocument = true) : Media (bDocument)
{
}
ActiveX_bin(const OOX::CPath& filename)
{
read(filename);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
{
}
virtual const FileType type() const
{
return OOX::FileTypes::ActiveX_bin;
}
virtual const CPath DefaultDirectory() const
{
if (m_bDocument) return type().DefaultDirectory();
else return L"../" + type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
void set_filename_cache(const std::wstring & file_path)
{
m_filenameCache = file_path;
}
void set_filename_cache(CPath & file_path)
{
m_filenameCache = file_path;
}
CPath filename_cache()
{
return m_filenameCache;
}
protected:
CPath m_filenameCache; //image
};
} // namespace OOX
#endif // OOX_ACTIVEX_INCLUDE_H_

View File

@ -78,8 +78,11 @@ namespace OOX
{
return m_filename;
}
void copy_to(const CPath& path) const
virtual void copy_to(const CPath& path) const
{
OOX::CPath pathSaveItem = path + FILE_SEPARATOR_STR + m_filename.GetFilename();
NSFile::CFileBinary::Copy(m_filename.GetPath(), pathSaveItem.GetPath());
}
virtual const CPath DefaultDirectory() const
{

View File

@ -0,0 +1,79 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_VBA_PROJECT_INCLUDE_H_
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace OOX
{
class VbaProject : public Media, public OOX::IFileContainer
{
public:
VbaProject( )
{
}
VbaProject(const CPath& oRootPath, const CPath& filename)
{
read( oRootPath, filename );
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
IFileContainer::Read( oRootPath, oPath );
Media::read(oPath);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, CContentTypes& content) const
{
content.Registration( type().OverrideType(), directory, filename.GetFilename() );
IFileContainer::Write( filename, directory, content );
}
virtual const FileType type() const
{
return OOX::FileTypes::VbaProject;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
protected:
};
} // namespace OOX
#endif // OOX_VBA_PROJECT_INCLUDE_H_

View File

@ -1063,7 +1063,11 @@ namespace OOX
et_x_OleObjects,
et_x_OleObject,
et_x_OleObjectPr,
et_x_OleObjectAnchor,
et_x_ExtAnchor,
et_x_Controls,
et_x_Control,
et_x_ControlPr,
et_x_OcxPr,
et_x_TableParts,
et_x_TablePart,
et_x_Table,

View File

@ -0,0 +1,395 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTROLS_FILE_INCLUDE_H_
#define OOX_CONTROLS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "../Drawing/FromTo.h"
#include "../Ole/OleObjects.h"
#include "../../DocxFormat/Media/ActiveX.h"
namespace OOX
{
namespace Spreadsheet
{
class CControlPr : public WritingElement
{
public:
WritingElement_AdditionConstructors(CControlPr)
CControlPr()
{
}
virtual ~CControlPr()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(L"<controlPr");
WritingStringNullableAttrEncodeXmlString(L"altText", m_oAltText, m_oAltText.get());
WritingStringNullableAttrBool(L"autoFill", m_oAutoFill);
WritingStringNullableAttrBool(L"autoLine", m_oAutoLine);
WritingStringNullableAttrBool(L"autoPict", m_oAutoPict);
WritingStringNullableAttrBool(L"dde", m_oDde);
WritingStringNullableAttrBool(L"defaultSize", m_oDefaultSize);
WritingStringNullableAttrBool(L"disabled", m_oDisabled);
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
WritingStringNullableAttrBool(L"locked", m_oLocked);
WritingStringNullableAttrEncodeXmlString(L"macro", m_oMacro, m_oMacro.get());
WritingStringNullableAttrBool(L"print", m_oPrint);
WritingStringNullableAttrBool(L"uiObject", m_oUiObject);
writer.WriteString(L">");
if (m_oAnchor.IsInit())
{
m_oAnchor->toXML(writer);
}
writer.WriteString(L"</controlPr>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("anchor") == sName )
{
m_oAnchor = oReader;
}
}
}
virtual EElementType getType () const
{
return et_x_ControlPr;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("altText"), m_oAltText )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoFill"), m_oAutoFill )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoLine"), m_oAutoLine )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoPict"), m_oAutoPict )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dde"), m_oDde )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("defaultSize"), m_oDefaultSize )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("disabled"), m_oDisabled )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:id"), m_oRid )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("locked"), m_oLocked )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("macro"), m_oMacro )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("print"), m_oPrint )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("uiObject"), m_oUiObject )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<std::wstring> m_oAltText;
nullable<SimpleTypes::COnOff<>> m_oAutoFill;
nullable<SimpleTypes::COnOff<>> m_oAutoLine;
nullable<SimpleTypes::COnOff<>> m_oAutoPict;
nullable<SimpleTypes::COnOff<>> m_oDde;
nullable<SimpleTypes::COnOff<>> m_oDefaultSize;
nullable<SimpleTypes::COnOff<>> m_oDisabled;
nullable<SimpleTypes::CRelationshipId> m_oRid;
nullable<SimpleTypes::COnOff<>> m_oLocked;
nullable<std::wstring> m_oMacro;
nullable<SimpleTypes::COnOff<>> m_oPrint;
nullable<SimpleTypes::COnOff<>> m_oUiObject;
nullable<CExtAnchor> m_oAnchor;
};
class CControl : public WritingElement
{
public:
WritingElement_AdditionConstructors(CControl)
CControl()
{
}
virtual ~CControl()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
bool bAlternateContent = m_oControlPr.IsInit();
if (bAlternateContent)
{
writer.WriteString(L"<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"><mc:Choice Requires=\"x14\">");
toXML2(writer, true);
writer.WriteString(L"</mc:Choice><mc:Fallback>");
toXML2(writer, false);
writer.WriteString(L"</mc:Fallback></mc:AlternateContent>");
}
else
{
toXML2(writer, true);
}
}
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool bControlPr) const
{
writer.WriteString(L"<control");
WritingStringNullableAttrEncodeXmlString(L"progId", m_oProgId, m_oProgId.get());
WritingStringNullableAttrString(L"dvAspect", m_oDvAspect, m_oDvAspect->ToString());
WritingStringNullableAttrEncodeXmlString(L"link", m_oLink, m_oLink.get());
WritingStringNullableAttrString(L"oleUpdate", m_oOleUpdate, m_oOleUpdate->ToString());
WritingStringNullableAttrBool(L"autoLoad", m_oAutoLoad);
WritingStringNullableAttrInt(L"shapeId", m_oShapeId, m_oShapeId->GetValue());
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
if (bControlPr && m_oControlPr.IsInit())
{
writer.WriteString(L">");
m_oControlPr->toXML(writer);
writer.WriteString(L"</control>");
}
else
{
writer.WriteString(L"/>");
}
}
// void toXMLPptx(NSStringUtils::CStringBuilder& writer, std::wstring qqq)
//{
// std::wstring sRoot;
// writer.WriteString(L"<o:OLEObject");
// if(m_oDvAspect.IsInit())
// {
// writer.WriteString(L" DrawAspect=\"");
// if(SimpleTypes::Spreadsheet::Content == m_oDvAspect->GetValue())
// writer.WriteString(L"Content");
// else
// writer.WriteString(L"Icon");
// writer.WriteString(L"\"");
// }
// WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
// WritingStringNullableAttrEncodeXmlString(L"ProgID", m_oProgId, m_oProgId.get());
// WritingStringNullableAttrInt(L"ShapeID", m_oShapeId, m_oShapeId->GetValue());
// writer.WriteString(L" Type=\"Embed\"");
// if(m_oOleUpdate.IsInit())
// {
// writer.WriteString(L" UpdateMode=\"");
// if(SimpleTypes::Spreadsheet::Always == m_oOleUpdate->GetValue())
// writer.WriteString(L"Always");
// else
// writer.WriteString(L"OnCall");
// writer.WriteString(L"\"");
// }
// if (m_OleObjectFile.IsInit())
// {
// if (m_OleObjectFile->isMsPackage())
// WritingStringAttrString(L"mspackage", L"true");
// WritingStringAttrEncodeXmlString(L"pathbin", m_OleObjectFile->filename().GetPath());
// WritingStringAttrEncodeXmlString(L"pathimg", m_OleObjectFile->filename_cache().GetPath());
// }
// writer.WriteString(L"/>");
//}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("controlPr") == sName )
{
m_oControlPr = oReader;
}
}
}
virtual EElementType getType () const
{
return et_x_Control;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("progId"), m_oProgId )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dvAspect"), m_oDvAspect )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("link"), m_oLink )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("oleUpdate"),m_oOleUpdate )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoLoad"), m_oAutoLoad )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("shapeId"), m_oShapeId )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:id"), m_oRid )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<std::wstring > m_oProgId;
nullable<SimpleTypes::Spreadsheet::ST_DvAspect<>> m_oDvAspect;
nullable<std::wstring > m_oLink;
nullable<SimpleTypes::Spreadsheet::ST_OleUpdate<>> m_oOleUpdate;
nullable<SimpleTypes::COnOff<>> m_oAutoLoad;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oShapeId;
nullable<SimpleTypes::CRelationshipId> m_oRid;
nullable<CControlPr> m_oControlPr;
//internal
smart_ptr<OOX::ActiveX_xml> m_ControlFile;
nullable<SimpleTypes::CRelationshipId> m_oRidImg;
};
class CControls : public WritingElement
{
public:
WritingElement_AdditionConstructors(CControls)
CControls()
{
}
virtual ~CControls()
{
for(std::map<int, CControl*>::const_iterator it = m_mapControls.begin(); it != m_mapControls.end(); it++)
{
delete it->second;
}
m_mapControls.clear();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_mapControls.size() > 0)
{
writer.WriteString(L"<controls>");
for(std::map<int, CControl*>::const_iterator it = m_mapControls.begin(); it != m_mapControls.end(); it++)
{
it->second->toXML(writer);
}
writer.WriteString(L"</controls>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("controls") == sName )
{
CControl* pControl = new CControl(oReader);
if(pControl->m_oShapeId.IsInit())
{
m_mapControls[pControl->m_oShapeId->GetValue()] = pControl;
}
else
{
delete pControl;
}
}
else if ( _T("AlternateContent") == sName )
{
int nSubDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nSubDepth ) )
{
std::wstring sSubName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("Fallback") == sSubName || _T("Choice") == sSubName )
{
bool bFound = false;
int nSubSubDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nSubSubDepth ) )
{
std::wstring sSubSubName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("control") == sSubSubName )
{
CControl* pControl = new CControl(oReader);
if(pControl->m_oShapeId.IsInit())
{
m_mapControls[pControl->m_oShapeId->GetValue()] = pControl;
bFound = true;
break;
}
else
{
delete pControl;
}
}
}
if (bFound)
{
break;
}
}
}
}
}
}
virtual EElementType getType () const
{
return et_x_Controls;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
std::map<int, CControl*> m_mapControls;
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_CONTROLS_FILE_INCLUDE_H_

View File

@ -36,7 +36,8 @@
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
#include "../DocxFormat/VmlDrawing.h"
#include "../DocxFormat/Media/OleObject.h"
#include "../DocxFormat/Media/ActiveX.h"
#include "../DocxFormat/Media/VbaProject.h"
#include "SharedStrings/SharedStrings.h"
#include "Styles/Styles.h"
@ -64,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 ));
@ -119,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 ));
@ -177,6 +180,10 @@ namespace OOX
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing( oRootPath, oFileName ));
else if ( pRelation->Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OOX::OleObject( oFileName, true ));
else if ( pRelation->Type() == OOX::FileTypes::ActiveX_xml)
return smart_ptr<OOX::File>(new OOX::ActiveX_xml( oRootPath, oFileName ));
else if ( pRelation->Type() == OOX::FileTypes::ActiveX_bin)
return smart_ptr<OOX::File>(new OOX::ActiveX_bin( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}

View File

@ -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"));

View File

@ -40,14 +40,14 @@ namespace OOX
{
namespace Spreadsheet
{
class COleObjectAnchor : public WritingElement
class CExtAnchor : public WritingElement
{
public:
WritingElement_AdditionConstructors(COleObjectAnchor)
COleObjectAnchor()
WritingElement_AdditionConstructors(CExtAnchor)
CExtAnchor()
{
}
virtual ~COleObjectAnchor()
virtual ~CExtAnchor()
{
}
@ -100,7 +100,7 @@ namespace OOX
virtual EElementType getType () const
{
return et_x_OleObjectAnchor;
return et_x_ExtAnchor;
}
private:
@ -219,7 +219,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oPrint;
nullable<SimpleTypes::COnOff<>> m_oUiObject;
nullable<COleObjectAnchor> m_oAnchor;
nullable<CExtAnchor> m_oAnchor;
};
class COleObject : public WritingElement
@ -255,7 +255,7 @@ namespace OOX
toXML2(writer, true);
}
}
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool ObjectPr) const
virtual void toXML2(NSStringUtils::CStringBuilder& writer, bool bObjectPr) const
{
writer.WriteString(L"<oleObject");
WritingStringNullableAttrEncodeXmlString(L"progId", m_oProgId, m_oProgId.get());
@ -265,7 +265,7 @@ namespace OOX
WritingStringNullableAttrBool(L"autoLoad", m_oAutoLoad);
WritingStringNullableAttrInt(L"shapeId", m_oShapeId, m_oShapeId->GetValue());
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
if (ObjectPr && m_oObjectPr.IsInit())
if (bObjectPr && m_oObjectPr.IsInit())
{
writer.WriteString(L">");
m_oObjectPr->toXML(writer);

View File

@ -53,8 +53,6 @@ namespace OOX
virtual ~CWorkbook()
{
}
public:
virtual void read(const CPath& oPath)
{
}
@ -77,26 +75,19 @@ namespace OOX
{
return m_oReadPath;
}
public:
void ClearItems()
{
}
std::vector<WritingElement *> m_arrItems;
private:
CPath m_oReadPath;
CPath m_oReadPath;
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:conformance"), m_oConformance )
WritingElement_ReadAttributes_End( oReader )
}
public:
std::vector<WritingElement *> m_arrItems;
};
} //Spreadsheet
} // namespace OOX

View File

@ -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

View File

@ -225,7 +225,6 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start(oReader)
WritingElement_ReadAttributes_Read_if (oReader, _T("maxLength") , m_oMaxLength)
@ -279,7 +278,6 @@ namespace OOX
return et_x_FormulaCF;
}
public:
std::wstring m_sText;
};

View File

@ -51,6 +51,8 @@
#include "../Table/Table.h"
#include "../Comments/Comments.h"
#include "../Ole/OleObjects.h"
#include "../Controls/Controls.h"
#include "../../../../../DesktopEditor/common/String.h"
namespace OOX
@ -60,12 +62,10 @@ namespace OOX
//необработанные child:
//<cellWatches>
//<colBreaks>
//<controls>
//<customProperties>
//<dataConsolidate>
//<dataValidations>
//<extLst>
//<oleObjects>
//<phoneticPr>
//<protectedRanges>
//<rowBreaks>
@ -92,8 +92,6 @@ namespace OOX
{
ClearItems();
}
public:
virtual void read(const CPath& oPath)
{
//don't use this. instead use read(const CPath& oRootPath, const CPath& oFilePath)
@ -157,6 +155,8 @@ namespace OOX
m_oLegacyDrawingHF = oReader;
else if ( _T("oleObjects") == sName )
m_oOleObjects = oReader;
else if ( _T("controls") == sName )
m_oControls = oReader;
else if ( _T("headerFooter") == sName )
m_oHeaderFooter = oReader;
else if (_T("sheetPr") == sName)
@ -379,6 +379,8 @@ namespace OOX
m_oLegacyDrawingHF->toXML(sXml);
if(m_oOleObjects.IsInit())
m_oOleObjects->toXML(sXml);
if (m_oControls.IsInit())
m_oControls->toXML(sXml);
if(m_oTableParts.IsInit())
m_oTableParts->toXML(sXml);
if(m_oExtLst.IsInit())
@ -441,7 +443,6 @@ namespace OOX
}
m_arrConditionalFormatting.clear();
}
private:
CPath m_oReadPath;
public:
@ -460,6 +461,7 @@ namespace OOX
nullable<OOX::Spreadsheet::CTableParts> m_oTableParts;
nullable<OOX::Spreadsheet::CLegacyDrawingWorksheet> m_oLegacyDrawing;
nullable<OOX::Spreadsheet::COleObjects> m_oOleObjects;
nullable<OOX::Spreadsheet::CControls> m_oControls;
std::map<std::wstring, CCommentItem*> m_mapComments;
std::vector<OOX::Spreadsheet::CConditionalFormatting*> m_arrConditionalFormatting;
nullable<OOX::Spreadsheet::CSheetPr> m_oSheetPr;

View File

@ -97,8 +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->();
if (pFile.IsInit() == false)
{
pFile = Find(OOX::Spreadsheet::FileTypes::WorkbookMacro);
}
if (pFile.IsInit())
{
m_pWorkbook = dynamic_cast<OOX::Spreadsheet::CWorkbook*>(pFile.operator->());
}
else
m_pWorkbook = NULL;
@ -185,7 +191,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);

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.472.0
VERSION = 2.4.475.0
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -133,35 +133,41 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT2DOCX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT2RTF;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY:
{
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST2XLSX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST2CSV;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY:
{
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT2PPTX;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT_BIN2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT_BIN2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_BIN2T;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT_BIN2RTF;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
{
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST_BIN2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST_BIN2XLSX;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_BIN2T;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST_BIN2CSV;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION:
{
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT_BIN2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT_BIN2PPTX;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_BIN2T;
}break;
case AVS_OFFICESTUDIO_FILE_CANVAS_PDF:
@ -171,18 +177,21 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
{
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_CSV2XLSX;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_RTF2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
{
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(".doct"))) res = TCD_DOC2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN;
}break;
@ -195,12 +204,14 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT:
{
if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_TXT2DOCX;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN;
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT:
{
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(".bin"))) res = TCD_PPT2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT;
}break;
@ -215,6 +226,9 @@ namespace NExtractTools
else if (0 == sExt2.compare(_T(".docx")) ||
0 == sExt2.compare(_T(".xlsx")) ||
0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX;
else if (0 == sExt2.compare(_T(".docm")) ||
0 == sExt2.compare(_T(".xlsm")) ||
0 == sExt2.compare(_T(".pptm"))) res = TCD_ODF2OOX;
}break;
case AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO:
{

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/agg-2.4/include&quot;;&quot;C:\__Work\core\DesktopEditor\agg-2.4\include&quot;"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/agg-2.4/include&quot;;../../../DesktopEditor/xml/build/vs2005;../../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"

View File

@ -191,7 +191,12 @@ namespace BinXlsxRW
PivotCache = 8,
ExternalBook = 9,
OleLink = 10,
DdeLink = 11
DdeLink = 11,
VbaProject = 12
};}
namespace c_oSerWorkbookVbaProjectTypes{enum c_oSerWorkbookVbaProjectTypes
{
Name = 0
};}
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
{

View File

@ -37,6 +37,8 @@
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/OfficeFileFormats.h"
#include "../../Common/Base64.h"
@ -1520,6 +1522,16 @@ namespace BinXlsxRW
WriteExternalReferences(workbook.m_oExternalReferences.get(), workbook);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
smart_ptr<OOX::File> fileVbaProject = workbook.Get(OOX::FileTypes::VbaProject);
if (fileVbaProject.IsInit() && OOX::FileTypes::VbaProject == fileVbaProject->type())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::VbaProject);
smart_ptr<OOX::VbaProject> vbaProject = fileVbaProject.smart_dynamic_cast<OOX::VbaProject>();
WriteVbaProject (vbaProject);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
};
void WriteWorkbookPr(const OOX::Spreadsheet::CWorkbookPr& workbookPr)
{
@ -1924,7 +1936,6 @@ namespace BinXlsxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDefinedName(const OOX::Spreadsheet::CDefinedName& definedName)
{
int nCurPos = 0;
@ -1960,7 +1971,19 @@ namespace BinXlsxRW
m_oBcw.m_oStream.WriteBYTE(c_oSerDefinedNameTypes::Comment);
m_oBcw.m_oStream.WriteStringW(definedName.m_oComment.get2());
}
};
}
void WriteVbaProject(smart_ptr<OOX::VbaProject> & fileVbaProject)
{
std::wstring file_name = fileVbaProject->filename().GetFilename();
m_oBcw.m_oStream.WriteBYTE(c_oSerWorkbookVbaProjectTypes::Name);
m_oBcw.m_oStream.WriteStringW(file_name);
//... todooo write parsing vba project
//copy file bin
fileVbaProject->copy_to(m_oBcw.m_oStream.m_pCommon->m_pImageManager->m_strDstMedia);
}
};
class BinaryWorksheetTableWriter
{
@ -2959,7 +2982,7 @@ namespace BinXlsxRW
bool bSetAnchor = false;
if (pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oAnchor.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit())
{
const OOX::Spreadsheet::COleObjectAnchor& oAnchor = pOleObject->m_oObjectPr->m_oAnchor.get();
const OOX::Spreadsheet::CExtAnchor& oAnchor = pOleObject->m_oObjectPr->m_oAnchor.get();
SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType;
eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell);

View File

@ -36,6 +36,8 @@
#include "../../Common/ATLDefine.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/Directory.h"
@ -1504,8 +1506,10 @@ namespace BinXlsxRW {
{
OOX::Spreadsheet::CWorkbook& m_oWorkbook;
std::map<long, NSCommon::smart_ptr<OOX::File>>& m_mapPivotCacheDefinitions;
const std::wstring& m_sDestinationDir;
public:
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions):Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions)
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions, const std::wstring& sDestinationDir)
: Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions), m_sDestinationDir(sDestinationDir)
{
}
int Read()
@ -1542,6 +1546,10 @@ namespace BinXlsxRW {
res = Read1(length, &BinaryWorkbookTableReader::ReadPivotCaches, this, poResult);
m_oWorkbook.m_oPivotCachesXml->append(L"</pivotCaches>");
}
else if(c_oSerWorkbookTypes::VbaProject == type)
{
res = Read1(length, &BinaryWorkbookTableReader::ReadVbaProject, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -2068,7 +2076,7 @@ namespace BinXlsxRW {
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadPivotCache(BYTE type, long length, void* poResult)
{
PivotCachesTemp* pPivotCachesTemp = static_cast<PivotCachesTemp*>(poResult);
@ -2090,13 +2098,39 @@ namespace BinXlsxRW {
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadVbaProject(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if(c_oSerWorkbookVbaProjectTypes::Name == type)
{
std::wstring file_name = m_oBufferedStream.GetString4(length);
OOX::CPath inputPath = m_oBufferedStream.m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + file_name;
OOX::CPath outputPath = m_sDestinationDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("vbaProject.bin");
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
smart_ptr<OOX::VbaProject> oFileVbaProject(new OOX::VbaProject());
oFileVbaProject->set_filename(outputPath.GetPath());
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;
}
else
res = c_oSerConstants::ReadUnknown;
}
};
class BinaryCommentReader : public Binary_CommonReader<BinaryCommentReader>
{
OOX::Spreadsheet::CWorksheet* m_pCurWorksheet;
public:
BinaryCommentReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorksheet* pCurWorksheet):Binary_CommonReader(oBufferedStream),m_pCurWorksheet(pCurWorksheet)
BinaryCommentReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorksheet* pCurWorksheet)
: Binary_CommonReader(oBufferedStream), m_pCurWorksheet(pCurWorksheet)
{
}
int Read(long length, void* poResult)
@ -4414,7 +4448,7 @@ namespace BinXlsxRW {
if(-1 != nWorkbookOffBits)
{
oBufferedStream.Seek(nWorkbookOffBits);
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions).Read();
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions, sOutDir).Read();
if(c_oSerConstants::ReadOk != res)
return res;
}