mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-02 06:31:48 +08:00
Compare commits
42 Commits
v4.5.dev.1
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 792a722063 | |||
| 00df026108 | |||
| 56a4e80c83 | |||
| a7a78a09c1 | |||
| 6f93eeae69 | |||
| be45d169d7 | |||
| 0fc749f839 | |||
| 03267ba2ec | |||
| b0adc188a2 | |||
| 048fbc4b18 | |||
| c0a061f2cb | |||
| 0296a6ef33 | |||
| dcee112745 | |||
| 65709f9cc2 | |||
| bf5c41b9a0 | |||
| 66b45dba7c | |||
| 65e7372cf7 | |||
| 2ce5708599 | |||
| 1ea27ad7f8 | |||
| 48d94d24eb | |||
| f5c569ab2a | |||
| 2e61fcfdd9 | |||
| 3df883cbe8 | |||
| 0ed3f740b7 | |||
| af2e76aea6 | |||
| 6593230d48 | |||
| e02c72b564 | |||
| c2964f92af | |||
| 15fb3a4f4e | |||
| cff1836571 | |||
| cb57db3c8a | |||
| d22fb105b6 | |||
| 89aba918bc | |||
| 47c1e6f637 | |||
| f5284c967b | |||
| d465e29a0f | |||
| f43ef621cb | |||
| 2f9a8eb77f | |||
| a70087e1f2 | |||
| c3da9a66a1 | |||
| f907a90be7 | |||
| 89ce79dafc |
@ -75,6 +75,8 @@ namespace DocFileFormat
|
||||
|
||||
while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] )
|
||||
{
|
||||
int cpStart = cp;
|
||||
|
||||
int fc = m_document->FindFileCharPos(cp);
|
||||
if (fc < 0) break;
|
||||
|
||||
@ -93,6 +95,8 @@ namespace DocFileFormat
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
}
|
||||
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
|
||||
cp++;
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:footnote");
|
||||
|
||||
@ -124,11 +124,14 @@ namespace DocFileFormat
|
||||
TableInfo tai(papx);
|
||||
if (tai.fInTable)
|
||||
{
|
||||
int cpStart = cp;
|
||||
//this PAPX is for a table
|
||||
//cp = writeTable( cp, tai.iTap );
|
||||
Table table( this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ) );
|
||||
table.Convert(this);
|
||||
cp = table.GetCPEnd();
|
||||
while (cp <= cpStart) //conv_eznHsm8em2unSv6_2QE__docx.doc
|
||||
cp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -2,34 +2,38 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
|
||||
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
|
||||
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
|
||||
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
|
||||
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
|
||||
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
|
||||
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\OfficeUtils\win32\OfficeUtilsLib.vcproj", "{F8274B05-168E-4D6E-B843-AA7510725363}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
|
||||
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
|
||||
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
|
||||
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
|
||||
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
|
||||
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
|
||||
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
|
||||
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
|
||||
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
|
||||
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
|
||||
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
|
||||
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
|
||||
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
|
||||
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
|
||||
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
|
||||
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
|
||||
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
|
||||
@ -54,17 +58,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOffic
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
|
||||
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
|
||||
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
|
||||
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
|
||||
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
|
||||
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
|
||||
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
|
||||
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
|
||||
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
|
||||
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
|
||||
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\..\..\Common\OfficeDrawing;"..\..\..\..\..\DesktopEditor\freetype-2.5.2\include";..\..\..\..\..\Common\OfficeDrawing\Shapes"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
{
|
||||
@ -3025,7 +3025,27 @@ namespace BinDocxRW
|
||||
std::wstring& sShapeType = aShapeTypes[i];
|
||||
pOfficeDrawingConverter->AddShapeType(sShapeType);
|
||||
}
|
||||
pOfficeDrawingConverter->SetRels(oldRels);
|
||||
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)
|
||||
{
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -51,6 +51,7 @@ public:
|
||||
|
||||
// $Лист1.$A$1 -> Лист1!$A$1
|
||||
std::wstring convert_named_ref(std::wstring const & expr, bool withTableName = true, std::wstring separator = L" ");
|
||||
std::wstring get_table_name();
|
||||
|
||||
//a-la convert without check formula
|
||||
std::wstring convert_named_expr(std::wstring const & expr, bool withTableName = true);
|
||||
@ -90,7 +91,7 @@ public:
|
||||
std::wstring convert_named_ref (std::wstring const & expr);
|
||||
std::wstring convert_named_formula(std::wstring const & expr);
|
||||
|
||||
std::wstring get_base_cell_formula(std::wstring const & expr);
|
||||
std::wstring get_table_name();
|
||||
|
||||
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
|
||||
std::wstring convert_chart_distance(std::wstring const & expr);
|
||||
|
||||
@ -43,7 +43,6 @@ namespace formulasconvert {
|
||||
class odf2oox_converter::Impl
|
||||
{
|
||||
public:
|
||||
static bool convert_with_TableName;
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
@ -61,8 +60,12 @@ namespace formulasconvert {
|
||||
void replace_named_ref(std::wstring & expr, bool w = true);
|
||||
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
};
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
std::wstring odf2oox_converter::Impl::table_name_ = L"";
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
@ -152,6 +155,8 @@ namespace formulasconvert {
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
|
||||
@ -180,6 +185,8 @@ namespace formulasconvert {
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c3) );
|
||||
@ -559,6 +566,11 @@ namespace formulasconvert {
|
||||
{
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::convert(const std::wstring& expr)
|
||||
{
|
||||
return impl_->convert(expr);
|
||||
@ -590,6 +602,13 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
@ -629,6 +648,13 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
|
||||
@ -65,11 +65,11 @@ public:
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
|
||||
static std::wstring base_cell_formula_;
|
||||
static std::wstring table_name_;
|
||||
};
|
||||
|
||||
bool oox2odf_converter::Impl::isFindBaseCell_ = false;
|
||||
std::wstring oox2odf_converter::Impl::base_cell_formula_ = L"";
|
||||
std::wstring oox2odf_converter::Impl::table_name_ = L"";
|
||||
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
{
|
||||
@ -117,9 +117,9 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
if (isFindBaseCell_ && base_cell_formula_.empty() && !sheet.empty())
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
base_cell_formula_ = sheet + L".$A$1";
|
||||
table_name_ = sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
@ -161,7 +161,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
table_name_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
expr = convert_formula(expr);
|
||||
@ -171,7 +171,7 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
base_cell_formula_.clear();
|
||||
table_name_.clear();
|
||||
|
||||
isFindBaseCell_ = true;
|
||||
std::wstring workstr = expr, out;
|
||||
@ -207,6 +207,15 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
if (!out.empty()) expr = out.substr(0, out.length() - 1);
|
||||
|
||||
isFindBaseCell_ = false;
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -471,6 +480,21 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
XmlUtils::replace_all( res, L"PROBEL", L" ");
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATOUT", L"]");
|
||||
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
}
|
||||
|
||||
return std::wstring(L"of:=") + res;
|
||||
|
||||
}
|
||||
@ -614,9 +638,9 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
|
||||
impl_->replace_named_formula(workstr);
|
||||
return workstr;
|
||||
}
|
||||
std::wstring oox2odf_converter::get_base_cell_formula(const std::wstring& expr)
|
||||
std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->base_cell_formula_;
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -74,6 +74,8 @@ xlsx_document::xlsx_document()
|
||||
|
||||
void xlsx_document::write(const std::wstring & RootPath)
|
||||
{
|
||||
_CP_LOG << L"[info][xlsx] process writing" << std::endl;
|
||||
|
||||
xl_files_.write (RootPath);
|
||||
docProps_files_.write (RootPath);
|
||||
rels_files_.write (RootPath);
|
||||
|
||||
@ -40,111 +40,70 @@ namespace oox {
|
||||
class xlsx_pivots_context::Impl
|
||||
{
|
||||
public:
|
||||
struct _pivot_cache
|
||||
struct _pivot_xml
|
||||
{
|
||||
std::wstring definitionsData_;
|
||||
std::wstring recordsData_;
|
||||
};
|
||||
struct _pivot_view
|
||||
{
|
||||
std::wstring data_;
|
||||
int indexCache_;
|
||||
};
|
||||
struct _pivot_field
|
||||
{
|
||||
std::wstring view_;
|
||||
std::wstring cache_;
|
||||
std::wstring definitionsData_; //cacheData
|
||||
std::wstring recordsData_; //cacheRecorda
|
||||
|
||||
std::wstring viewData_; //tableView
|
||||
};
|
||||
|
||||
Impl() {}
|
||||
|
||||
std::vector<_pivot_cache> caches_;
|
||||
std::vector<_pivot_view> views_;
|
||||
std::vector<_pivot_xml> pivot_xmls_;
|
||||
std::wstring connections_;
|
||||
|
||||
std::vector<_pivot_field> fields_;
|
||||
|
||||
std::wstringstream view_;
|
||||
std::wstringstream cache_;
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
int type = -1;
|
||||
int function = -1;
|
||||
std::wstring user_function;
|
||||
std::vector<int> subtotals;
|
||||
std::vector<std::wstring> caches;
|
||||
};
|
||||
struct _desc
|
||||
{
|
||||
void clear()
|
||||
{
|
||||
name.clear();
|
||||
location_ref.clear();
|
||||
source_ref.clear();
|
||||
fields.clear();
|
||||
row_fields.clear();
|
||||
page_fields.clear();
|
||||
col_fields.clear();
|
||||
data_fields.clear();
|
||||
}
|
||||
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;
|
||||
std::vector<int> col_fields;
|
||||
std::vector<int> data_fields;
|
||||
}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())
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::add_cache(std::wstring definitions, std::wstring records)
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
Impl::_pivot_cache c = {definitions, records};
|
||||
impl_->caches_.push_back(c);
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_cache_count()
|
||||
{
|
||||
return (int)impl_->caches_.size();
|
||||
}
|
||||
bool xlsx_pivots_context::is_connections()
|
||||
{
|
||||
return !impl_->connections_.empty();
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->caches_[index].recordsData_.empty() == false)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->views_[index].indexCache_ >= 0)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
|
||||
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(impl_->views_[index].indexCache_ + 1) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->caches_[index].definitionsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connections")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_STREAM() << impl_->connections_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->caches_[index].recordsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->views_[index].data_;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::start_table()
|
||||
{
|
||||
impl_->fields_.clear();
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::end_table()
|
||||
{
|
||||
std::wstringstream strm;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotTableDefinition")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
//CP_XML_ATTR(L"name", view->stTable.value());
|
||||
//CP_XML_ATTR(L"cacheId", view->iCache);
|
||||
CP_XML_ATTR(L"name", current_.name);
|
||||
CP_XML_ATTR(L"cacheId", pivot_xmls_.size());
|
||||
//CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
|
||||
//CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
|
||||
//CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
|
||||
@ -168,7 +127,7 @@ int xlsx_pivots_context::end_table()
|
||||
|
||||
CP_XML_NODE(L"location")
|
||||
{
|
||||
//CP_XML_ATTR(L"ref", view->ref.toString());
|
||||
CP_XML_ATTR(L"ref", current_.location_ref);
|
||||
//CP_XML_ATTR(L"firstHeaderRow", view->rwFirstHead - view->ref.rowFirst );
|
||||
//CP_XML_ATTR(L"firstDataRow", view->rwFirstData - view->ref.rowFirst);
|
||||
//CP_XML_ATTR(L"firstDataCol", view->colFirstData - view->ref.columnFirst);
|
||||
@ -177,36 +136,307 @@ int xlsx_pivots_context::end_table()
|
||||
}
|
||||
CP_XML_NODE(L"pivotFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", impl_->fields_.size());
|
||||
for (size_t i = 0; i < impl_->fields_.size(); i++)
|
||||
CP_XML_ATTR(L"count", current_.fields.size());
|
||||
for (size_t i = 0; i < current_.fields.size(); i++)
|
||||
{
|
||||
impl_->fields_[i].view_;
|
||||
CP_XML_NODE(L"pivotField")
|
||||
{
|
||||
switch(current_.fields[i].type)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"axis", L"axisCol"); break;
|
||||
case 1: break;// data,
|
||||
case 2: break;// hidden,
|
||||
case 3: CP_XML_ATTR(L"axis", L"axisPage"); break;
|
||||
case 4: CP_XML_ATTR(L"axis", L"axisRow"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"defaultSubtotal", 0);
|
||||
//compact="0" outline="0" subtotalTop="0" showAll="0" includeNewItemsInFilter="1" sortType="ascending"
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//CP_XML_STREAM() << fields_[i].view_;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"rowFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.row_fields.size());
|
||||
for (size_t i = 0; i < current_.row_fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"field")
|
||||
{
|
||||
CP_XML_ATTR(L"x", current_.row_fields[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"colFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.col_fields.size());
|
||||
for (size_t i = 0; i < current_.col_fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"field")
|
||||
{
|
||||
CP_XML_ATTR(L"x", current_.col_fields[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"pageFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.page_fields.size());
|
||||
for (size_t i = 0; i < current_.page_fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"pageField")
|
||||
{
|
||||
CP_XML_ATTR(L"fld", current_.page_fields[i]);
|
||||
CP_XML_ATTR(L"item", 0);
|
||||
CP_XML_ATTR(L"hier", -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"dataFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.data_fields.size());
|
||||
for (size_t i = 0; i < current_.data_fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"dataField")
|
||||
{
|
||||
CP_XML_ATTR(L"fld", current_.data_fields[i]);
|
||||
CP_XML_ATTR(L"baseField", 0);
|
||||
//CP_XML_ATTR(L"baseItem", -1);
|
||||
//CP_XML_ATTR(L"name", L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Impl::_pivot_view v = {strm.str(), impl_->views_.size() + 1};
|
||||
impl_->views_.push_back(v);
|
||||
|
||||
return impl_->views_.size();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
bool xlsx_pivots_context::is_connections()
|
||||
{
|
||||
return !impl_->connections_.empty();
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->pivot_xmls_[index].recordsData_.empty() == false)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
|
||||
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(index + 1) + L".xml", L""));
|
||||
}
|
||||
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].definitionsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connections")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_STREAM() << impl_->connections_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].recordsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
|
||||
{
|
||||
strm << impl_->pivot_xmls_[index].viewData_;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::start_table()
|
||||
{
|
||||
impl_->current_.clear();
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::end_table()
|
||||
{
|
||||
std::wstringstream view_strm;
|
||||
std::wstringstream cache_strm;
|
||||
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()};
|
||||
|
||||
impl_->pivot_xmls_.push_back(v);
|
||||
|
||||
return impl_->pivot_xmls_.size();
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::set_view_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_view_target_range(std::wstring ref)
|
||||
{
|
||||
impl_->current_.location_ref = ref;
|
||||
}
|
||||
void xlsx_pivots_context::start_field()
|
||||
{
|
||||
Impl::_field f;
|
||||
impl_->current_.fields.push_back(f);
|
||||
}
|
||||
void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().type = type;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1); break;// column,
|
||||
case 1: impl_->current_.data_fields.push_back(impl_->current_.fields.size() - 1); break;// data,
|
||||
case 2: break;// hidden,
|
||||
case 3: impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1); break;// page,
|
||||
case 4: impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1); break;// row
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_function(int type)
|
||||
{
|
||||
impl_->current_.fields.back().function = type;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_user_function(std::wstring f)
|
||||
{
|
||||
impl_->current_.fields.back().user_function = f;
|
||||
}
|
||||
void xlsx_pivots_context::add_field_subtotal(int function_type)
|
||||
{
|
||||
impl_->current_.fields.back().subtotals.push_back(function_type);
|
||||
}
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
while (index > impl_->current_.fields.back().caches.size())
|
||||
{
|
||||
impl_->current_.fields.back().caches.push_back(L"");
|
||||
}
|
||||
impl_->current_.fields.back().caches.push_back(value);
|
||||
}
|
||||
void xlsx_pivots_context::end_field()
|
||||
{
|
||||
std::wstringstream strm;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotField")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Impl::_pivot_field f = {strm.str(), L""};
|
||||
|
||||
impl_->fields_.push_back(f);
|
||||
}
|
||||
void xlsx_pivots_context::set_source_range(std::wstring table_name, std::wstring ref)
|
||||
{
|
||||
impl_->current_.source_table_name = table_name;
|
||||
impl_->current_.source_ref = ref;
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::add_connections(std::wstring connections)
|
||||
@ -216,25 +446,10 @@ void xlsx_pivots_context::add_connections(std::wstring connections)
|
||||
impl_->connections_ = connections;
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_view_count()
|
||||
{
|
||||
return (int)impl_->views_.size();
|
||||
}
|
||||
|
||||
xlsx_pivots_context::~xlsx_pivots_context()
|
||||
{
|
||||
}
|
||||
|
||||
std::wostream & xlsx_pivots_context::stream_view()
|
||||
{
|
||||
return impl_->view_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_pivots_context::stream_cache()
|
||||
{
|
||||
return impl_->cache_;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -50,13 +50,20 @@ public:
|
||||
int end_table();
|
||||
|
||||
void start_field();
|
||||
void set_field_name(std::wstring name);
|
||||
void set_field_type(int type);
|
||||
void set_field_function(int type);
|
||||
void set_field_user_function(std::wstring f);
|
||||
void add_field_subtotal(int function_type);
|
||||
void add_field_cache(int index, std::wstring value);
|
||||
void end_field();
|
||||
|
||||
//int add_view(int indexCache);
|
||||
int get_view_count();
|
||||
int get_count();
|
||||
|
||||
void add_cache(std::wstring definitions, std::wstring records);
|
||||
int get_cache_count();
|
||||
void set_view_name(std::wstring name);
|
||||
void set_view_target_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);
|
||||
@ -70,9 +77,6 @@ public:
|
||||
void add_connections(std::wstring connections);
|
||||
bool is_connections();
|
||||
|
||||
std::wostream & stream_view();
|
||||
std::wostream & stream_cache();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
@ -160,7 +160,10 @@ void xlsx_table_state::set_table_row_group(int count, bool collapsed, int level)
|
||||
group_row_.collapsed = collapsed;
|
||||
group_row_.level = level;
|
||||
}
|
||||
|
||||
void xlsx_table_state::add_empty_row(int count)
|
||||
{
|
||||
current_table_row_ += count;
|
||||
}
|
||||
void xlsx_table_state::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
|
||||
{
|
||||
empty_row_ = true;
|
||||
|
||||
@ -89,6 +89,8 @@ public:
|
||||
void non_empty_row ();
|
||||
bool is_empty_row () const;
|
||||
void end_row ();
|
||||
|
||||
void add_empty_row(int count);
|
||||
|
||||
std::wstring current_row_style () const;
|
||||
std::wstring default_row_cell_style () const;
|
||||
|
||||
@ -148,9 +148,9 @@ void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableS
|
||||
|
||||
void xlsx_table_context::end_table()
|
||||
{
|
||||
xlsx_table_states_.pop_back();
|
||||
//xlsx_table_states_.pop_back();
|
||||
}
|
||||
|
||||
|
||||
void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned)
|
||||
{
|
||||
state()->start_cell(columnsSpanned, rowsSpanned);
|
||||
|
||||
@ -48,7 +48,6 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context * Context, xlsx_text_context & textCotnext);
|
||||
|
||||
public:
|
||||
void start_table(std::wstring tableName, std::wstring tableStyleName, int id);
|
||||
void end_table();
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
|
||||
|
||||
int pivot_cache_count = xlsx_pivots_context_.get_cache_count();
|
||||
int pivot_cache_count = xlsx_pivots_context_.get_count();
|
||||
if (pivot_cache_count > 0)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCaches")
|
||||
@ -259,7 +259,7 @@ void xlsx_conversion_context::end_document()
|
||||
}
|
||||
}
|
||||
}
|
||||
int pivot_view_count = xlsx_pivots_context_.get_view_count();
|
||||
int pivot_view_count = xlsx_pivots_context_.get_count();
|
||||
if (pivot_view_count > 0)
|
||||
{
|
||||
for (int i = 0; i < pivot_view_count; i++)
|
||||
@ -363,17 +363,33 @@ oox_chart_context & xlsx_conversion_context::current_chart()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
xlsx_xml_worksheet & xlsx_conversion_context::current_sheet()
|
||||
xlsx_xml_worksheet & xlsx_conversion_context::current_sheet(int index)
|
||||
{
|
||||
if (!sheets_.empty())
|
||||
{
|
||||
return *sheets_.back().get();
|
||||
if (index < 0) return *sheets_.back().get();
|
||||
else return *sheets_[index].get();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
int xlsx_conversion_context::find_sheet_by_name(std::wstring tableName)
|
||||
{
|
||||
if (tableName.empty()) return -1;
|
||||
|
||||
if (0 == tableName.find(L"'"))
|
||||
{
|
||||
tableName = tableName.substr(1, tableName.length() - 2);
|
||||
}
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
if (sheets_[i]->name() == tableName)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void xlsx_conversion_context::create_new_sheet(std::wstring const & name)
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
|
||||
@ -102,7 +102,10 @@ public:
|
||||
bool start_table (std::wstring tableName, std::wstring tableStyleName);
|
||||
void end_table ();
|
||||
|
||||
void start_table_column (unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax);
|
||||
int find_sheet_by_name(std::wstring tableName);
|
||||
xlsx_xml_worksheet & current_sheet(int index = -1);
|
||||
|
||||
void start_table_column (unsigned int repeated, const std::wstring & defaultCellStyleName, int & cMin, int & cMax);
|
||||
void table_column_last_width (double w);
|
||||
double table_column_last_width ();
|
||||
void end_table_column ();
|
||||
@ -162,7 +165,6 @@ public:
|
||||
xlsx_table_context & get_table_context() { return xlsx_table_context_; }
|
||||
const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
xlsx_xml_worksheet & current_sheet();
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
math_context & get_math_context() { return math_context_; }
|
||||
|
||||
@ -1274,16 +1274,27 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
{
|
||||
if (horizontal_margins.fo_margin_left_ && horizontal_margins.fo_margin_left_->get_type() == odf_types::length_or_percent::Length)
|
||||
CP_XML_ATTR(L"left" , horizontal_margins.fo_margin_left_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"left", 0);
|
||||
|
||||
if (horizontal_margins.fo_margin_right_ && horizontal_margins.fo_margin_right_->get_type() == odf_types::length_or_percent::Length)
|
||||
CP_XML_ATTR(L"right" , horizontal_margins.fo_margin_right_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"right", 0);
|
||||
|
||||
if (vertical_margins.fo_margin_top_ && vertical_margins.fo_margin_top_->get_type() == odf_types::length_or_percent::Length)
|
||||
CP_XML_ATTR(L"top" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"top", 1.025);
|
||||
|
||||
if (vertical_margins.fo_margin_bottom_ && vertical_margins.fo_margin_bottom_->get_type() == odf_types::length_or_percent::Length)
|
||||
CP_XML_ATTR(L"bottom" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"bottom", 1.025);
|
||||
|
||||
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
|
||||
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
|
||||
if (vertical_margins.fo_margin_top_)
|
||||
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"header", 0.7875);
|
||||
|
||||
if (vertical_margins.fo_margin_bottom_)
|
||||
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"footer", 0.7875);
|
||||
}
|
||||
}
|
||||
if (attlist_.fo_page_width_ || attlist_.fo_page_height_ || attlist_.style_print_orientation_)
|
||||
|
||||
@ -356,7 +356,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
|
||||
*/
|
||||
}
|
||||
|
||||
// table-table-cell-content
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::wostream & table_table_cell_content::text_to_stream(std::wostream & _Wostream) const
|
||||
@ -393,9 +392,14 @@ void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring
|
||||
void table_table_cell::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
bool table_table_cell::empty()
|
||||
{
|
||||
if (!content_.elements_.empty()) return false;
|
||||
if (attlist_.table_formula_) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
// table:covered-table-cell
|
||||
// table-covered-table-cell
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * table_covered_table_cell::ns = L"table";
|
||||
const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
|
||||
@ -412,13 +416,19 @@ void table_covered_table_cell::add_attributes( const xml::attributes_wc_ptr & At
|
||||
|
||||
void table_covered_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
empty_ = false;
|
||||
content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
void table_covered_table_cell::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
bool table_covered_table_cell::empty()
|
||||
{
|
||||
if (!content_.elements_.empty()) return false;
|
||||
if (attlist_.table_formula_) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// table:table-row
|
||||
@ -445,7 +455,38 @@ void table_table_row::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
bool table_table_row::empty()
|
||||
{
|
||||
if (content_.empty() && !attlist_.table_style_name_ && !attlist_.table_default_cell_style_name_) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
bool table_table_row::empty_content_cells()
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
table_table_cell *cell = dynamic_cast<table_table_cell*>(content_[i].get());
|
||||
table_covered_table_cell *cover_cell = dynamic_cast<table_covered_table_cell*>(content_[i].get());
|
||||
if (!cell && !cover_cell)
|
||||
{
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
if (cell && cell->empty() == false)
|
||||
{
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
if (cover_cell && cover_cell->empty() == false)
|
||||
{
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
// table:table-rows
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * table_table_rows::ns = L"table";
|
||||
|
||||
@ -361,6 +361,9 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
bool empty();
|
||||
bool empty_content_cells();
|
||||
|
||||
table_table_row_attlist attlist_;
|
||||
office_element_ptr_array content_; // table-table-cell or table-covered-table-cell
|
||||
|
||||
@ -408,6 +411,7 @@ private:
|
||||
|
||||
public:
|
||||
bool last_cell_;
|
||||
bool empty();
|
||||
|
||||
table_table_cell_attlist attlist_;
|
||||
table_table_cell_attlist_extra attlist_extra_;
|
||||
@ -427,7 +431,7 @@ public:
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
table_covered_table_cell() : last_cell_(false), empty_(true) {}
|
||||
table_covered_table_cell() : last_cell_(false){}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
@ -443,7 +447,7 @@ private:
|
||||
|
||||
public:
|
||||
bool last_cell_;
|
||||
bool empty_;
|
||||
bool empty();
|
||||
|
||||
table_table_cell_attlist attlist_;
|
||||
table_table_cell_content content_;
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "table_data_pilot_tables.h"
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -53,6 +54,7 @@ void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::w
|
||||
}
|
||||
void table_data_pilot_tables::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
return;
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
@ -72,7 +74,7 @@ void table_data_pilot_table::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
CP_APPLY_ATTR(L"table:identify-categories" , table_identify_categories_);
|
||||
CP_APPLY_ATTR(L"table:ignore-empty-rows" , table_ignore_empty_rows_);
|
||||
CP_APPLY_ATTR(L"table:show-filter-button" , table_show_filter_button_);
|
||||
CP_APPLY_ATTR(L"table:show-target-range-address", table_show_target_range_address_);
|
||||
CP_APPLY_ATTR(L"table:target-range-address" , table_target_range_address_);
|
||||
|
||||
}
|
||||
|
||||
@ -88,10 +90,26 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
{
|
||||
if (!source_) return;
|
||||
|
||||
int table_index = -1;
|
||||
|
||||
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_)
|
||||
{
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
|
||||
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
|
||||
std::wstring table_name = formulas_converter.get_table_name();
|
||||
|
||||
table_index = Context.find_sheet_by_name(table_name);
|
||||
|
||||
Context.get_pivots_context().set_view_target_range(ref);
|
||||
//Context.get_pivots_context().set_view_target_table(table_index);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fields_.size(); i++)
|
||||
{
|
||||
fields_[i]->xlsx_convert(Context);
|
||||
@ -101,7 +119,7 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
if (index_view > 0)
|
||||
{
|
||||
Context.current_sheet().sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(index_view),
|
||||
Context.current_sheet(table_index).sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(index_view),
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable",
|
||||
L"../pivotTables/pivotTable" + std::to_wstring(index_view) + L".xml"));
|
||||
}
|
||||
@ -123,16 +141,37 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
|
||||
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT (content_);
|
||||
if (L"table" == Ns && L"data-pilot-field-reference" == Name)
|
||||
CP_CREATE_ELEMENT (reference_);
|
||||
else if (L"table" == Ns && L"data-pilot-level" == Name)
|
||||
CP_CREATE_ELEMENT (level_);
|
||||
else if (L"table" == Ns && L"data-pilot-groups" == Name)
|
||||
CP_CREATE_ELEMENT (groups_);
|
||||
}
|
||||
void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_pivots_context().start_field();
|
||||
|
||||
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
|
||||
Context.get_pivots_context().set_field_type(table_orientation_.get_value_or(table_orientation::hidden).get_type());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
if (table_function_)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
table_function::type type = table_function_->get_type();
|
||||
|
||||
if (type == table_function::String)
|
||||
{
|
||||
Context.get_pivots_context().set_field_user_function(table_function_->get_string());
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.get_pivots_context().set_field_function(type);
|
||||
}
|
||||
}
|
||||
|
||||
if (reference_) reference_->xlsx_convert(Context);
|
||||
if (groups_) groups_->xlsx_convert(Context);
|
||||
if (level_) level_->xlsx_convert(Context);
|
||||
|
||||
Context.get_pivots_context().end_field();
|
||||
}
|
||||
@ -202,7 +241,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)
|
||||
@ -211,9 +250,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)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
if (table_cell_range_address_)
|
||||
{
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
|
||||
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(table_name, ref);
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
@ -242,15 +286,36 @@ void table_data_pilot_level::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
}
|
||||
void table_data_pilot_level::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT (content_);
|
||||
if (L"table" == Ns && L"data-pilot-members" == Name)
|
||||
CP_CREATE_ELEMENT (members_);
|
||||
else if (L"table" == Ns && L"data-pilot-subtotals" == Name)
|
||||
CP_CREATE_ELEMENT (subtotals_);
|
||||
else if (L"table" == Ns && L"data-pilot-display-info" == Name)
|
||||
CP_CREATE_ELEMENT ( display_info_);
|
||||
else if (L"table" == Ns && L"data-pilot-layout-info" == Name)
|
||||
CP_CREATE_ELEMENT ( layout_info_);
|
||||
else if (L"table" == Ns && L"data-pilot-sort-info" == Name)
|
||||
CP_CREATE_ELEMENT (sort_info_);
|
||||
}
|
||||
void table_data_pilot_level::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
table_data_pilot_members* members = dynamic_cast<table_data_pilot_members*>(members_.get());
|
||||
table_data_pilot_subtotals* subtotals = dynamic_cast<table_data_pilot_subtotals*>(subtotals_.get());
|
||||
|
||||
for (size_t i = 0; members && i < members->content_.size(); i++)
|
||||
{
|
||||
table_data_pilot_member* member = dynamic_cast<table_data_pilot_member*>(members->content_[i].get());
|
||||
if (member)
|
||||
Context.get_pivots_context().add_field_cache(i, member->table_name_.get_value_or(L""));
|
||||
}
|
||||
for (size_t i = 0; subtotals && i < subtotals->content_.size(); i++)
|
||||
{
|
||||
table_data_pilot_subtotal* subtotal = dynamic_cast<table_data_pilot_subtotal*>(subtotals->content_[i].get());
|
||||
if (subtotal)
|
||||
{
|
||||
Context.get_pivots_context().add_field_subtotal(subtotal->table_function_.get_value_or(table_function::Auto).get_type());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_groups::ns = L"table";
|
||||
|
||||
@ -65,8 +65,8 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_tables);
|
||||
@ -87,7 +87,9 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(std::wstring) table_target_range_address_;
|
||||
_CP_OPT(std::wstring) table_application_data_;
|
||||
_CP_OPT(std::wstring) table_buttons_;
|
||||
_CP_OPT(odf_types::Bool) table_drill_down_ondouble_click_;
|
||||
@ -95,7 +97,6 @@ private:
|
||||
_CP_OPT(odf_types::Bool) table_identify_categories_;
|
||||
_CP_OPT(odf_types::Bool) table_ignore_empty_rows_;
|
||||
_CP_OPT(odf_types::Bool) table_show_filter_button_;
|
||||
_CP_OPT(odf_types::Bool) table_show_target_range_address_;
|
||||
|
||||
office_element_ptr source_;
|
||||
office_element_ptr_array fields_;
|
||||
@ -119,6 +120,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_source_field_name_;
|
||||
_CP_OPT(odf_types::table_orientation) table_orientation_;
|
||||
_CP_OPT(int) table_used_hierarchy_;
|
||||
@ -127,7 +129,9 @@ private:
|
||||
_CP_OPT(std::wstring) table_selected_page_;
|
||||
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr reference_;
|
||||
office_element_ptr level_;
|
||||
office_element_ptr groups_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field);
|
||||
@ -147,6 +151,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_field_name_;
|
||||
_CP_OPT(std::wstring) table_member_name_;
|
||||
_CP_OPT(odf_types::member_type) table_member_type_;
|
||||
@ -171,6 +176,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(std::wstring) table_database_table_name_;
|
||||
};
|
||||
@ -193,6 +199,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(std::wstring) table_query_name_;
|
||||
};
|
||||
@ -215,6 +222,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_database_name_;
|
||||
_CP_OPT(odf_types::Bool)table_parse_sql_statement_;
|
||||
_CP_OPT(std::wstring) table_sql_statement_;
|
||||
@ -238,8 +246,9 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
_CP_OPT(std::wstring) table_cellrange_address_;
|
||||
office_element_ptr_array content_;
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_cell_range_address_;
|
||||
office_element_ptr_array content_; //filters
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_source_cell_range);
|
||||
@ -260,6 +269,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(std::wstring) table_object_name_;
|
||||
_CP_OPT(std::wstring) table_password_;
|
||||
@ -285,8 +295,14 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::Bool) table_show_empty_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
office_element_ptr members_;
|
||||
office_element_ptr subtotals_;
|
||||
office_element_ptr display_info_;
|
||||
office_element_ptr layout_info_;
|
||||
office_element_ptr sort_info_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_level);
|
||||
//-------------------------------------------------------------------------------------
|
||||
@ -306,6 +322,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_date_end_;
|
||||
_CP_OPT(std::wstring) table_date_start_;
|
||||
_CP_OPT(std::wstring) table_start; //double 18.2 or auto.
|
||||
@ -334,6 +351,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
@ -356,7 +374,8 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_members);
|
||||
|
||||
@ -377,8 +396,9 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(odf_types::Bool) table_show_details_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_member);
|
||||
@ -399,6 +419,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_name_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_group_member);
|
||||
@ -419,6 +440,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ){}
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
@ -440,6 +462,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::table_function) table_function_;
|
||||
};
|
||||
|
||||
@ -461,6 +484,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::Bool) table_add_empty_lines_;
|
||||
_CP_OPT(std::wstring) table_layout_mode_; //tabular-layout, outlinesubtotals-top or outline-subtotals-bottom.
|
||||
};
|
||||
@ -482,6 +506,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_data_field_;
|
||||
_CP_OPT(odf_types::table_order) table_order_;
|
||||
_CP_OPT(std::wstring) table_sort_mode_; //data, none, manual or name.
|
||||
@ -504,6 +529,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_data_field_;
|
||||
_CP_OPT(std::wstring) table_display_member_mode_; //from-top or from-bottom.
|
||||
_CP_OPT(odf_types::Bool) table_enabled_;
|
||||
@ -512,6 +538,5 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_display_info);
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -78,6 +78,17 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
|
||||
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (attlist_.table_number_rows_repeated_ > 1 && empty())
|
||||
{
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return;
|
||||
}
|
||||
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
|
||||
{
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
|
||||
}
|
||||
|
||||
std::wostream & strm = Context.current_sheet().sheetData();
|
||||
///обработка чтилей для роу -
|
||||
size_t Default_Cell_style_in_row_ = 0;
|
||||
@ -253,26 +264,20 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
table_table_rows_->xlsx_convert(Context);
|
||||
else
|
||||
{
|
||||
if (table_table_row_.size() > 1)
|
||||
while (table_table_row_.size() > 1)
|
||||
{
|
||||
//check 2 last rows for repeate > 65000 & 1024
|
||||
table_table_row* row_last = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 1].get());
|
||||
table_table_row* row_last_1 = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 2].get());
|
||||
|
||||
if (row_last->attlist_.table_number_rows_repeated_ > 1000 &&
|
||||
row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
|
||||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
|
||||
{
|
||||
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
|
||||
|
||||
if (style == style_1)//check for empty also ????
|
||||
{
|
||||
row_last_1->attlist_.table_number_rows_repeated_ = 1024;
|
||||
table_table_row_.pop_back();
|
||||
}
|
||||
}
|
||||
if (style != style_1)break;
|
||||
if (row_last_1->empty_content_cells() == false) break;
|
||||
if (row_last->empty_content_cells() == false) break;
|
||||
|
||||
row_last_1->attlist_.table_number_rows_repeated_ += row_last->attlist_.table_number_rows_repeated_;
|
||||
table_table_row_.pop_back();
|
||||
}
|
||||
for (size_t i = 0; i < table_table_row_.size(); i++)
|
||||
{
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../include;"../../DesktopEditor/freetype-2.5.2/include""
|
||||
AdditionalIncludeDirectories="../include;"../../DesktopEditor/freetype-2.5.2/include";../../DesktopEditor/xml/libxml2/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -113,7 +113,7 @@ void calcext_conditional_format::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
|
||||
|
||||
for (size_t i = content_.size() - 1; i >= 0; i--)
|
||||
for (int i = (int)content_.size() - 1; i >= 0; i--)
|
||||
{
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -269,4 +269,4 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,8 +54,9 @@ static int style_family_counts_[26]={};//согласно количеству
|
||||
void calc_paragraph_properties_content(std::vector<style_paragraph_properties*> & parProps, paragraph_format_properties * result)
|
||||
{
|
||||
if (result == NULL)return;
|
||||
if (parProps.empty()) return;
|
||||
|
||||
for (size_t i = parProps.size() - 1; i >= 0; i--)
|
||||
for (int i = (int)parProps.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (parProps[i])
|
||||
result->apply_from(parProps[i]->content_);
|
||||
@ -444,4 +445,4 @@ void odf_style_context::calc_paragraph_properties(std::wstring style_name, style
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
|
||||
XmlUtils::replace_all( odf_range, L"[", L"");
|
||||
XmlUtils::replace_all( odf_range, L"]", L"");
|
||||
|
||||
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(cell_range);
|
||||
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
|
||||
|
||||
named_range->table_name_ = name;
|
||||
named_range->table_cell_range_address_ = odf_range;
|
||||
@ -182,7 +182,7 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
|
||||
formulasconvert::oox2odf_converter formulas_converter;
|
||||
|
||||
std::wstring odf_value = formulas_converter.convert_named_formula(value);
|
||||
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(value);
|
||||
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
|
||||
|
||||
named_expression->table_name_ = name;
|
||||
named_expression->table_expression_ = odf_value;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -219,6 +219,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDefinedName *oox_defined)
|
||||
bool printable = false;
|
||||
if (name == L"_xlnm.Print_Area")printable = true;
|
||||
|
||||
//todoooo !!!! сделать анализ на функцию, диапазон, константы .... !!!
|
||||
|
||||
if (false)//если простой - range, составной - выражение
|
||||
ods_context->add_defined_range (name, oox_defined->m_oRef.get2(), sheet_id, printable);
|
||||
else
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../ASCOfficeOdfFile/include;../../../ASCOfficeOdfFile/src/odf/datatypes;"../../../DesktopEditor/freetype-2.5.2/include""
|
||||
AdditionalIncludeDirectories="../../../ASCOfficeOdfFile/include;../../../ASCOfficeOdfFile/src/odf/datatypes;../../../DesktopEditor/xml/libxml2/include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""../../../DesktopEditor/freetype-2.5.2/include""
|
||||
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=""../../../DesktopEditor/freetype-2.5.2/include""
|
||||
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"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\Common\OfficeDrawing;"..\..\DesktopEditor\freetype-2.5.2\include";..\..\Common\OfficeDrawing\Shapes"
|
||||
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_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_;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -2228,8 +2228,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
std::wstring strPos = arSplit[i].substr(0, p);
|
||||
std::wstring strColor = arSplit[i].substr(p + 1);
|
||||
|
||||
double pos;
|
||||
pos = _wtof(strPos.c_str());
|
||||
double pos = strPos.empty() ? 0 : _wtof(strPos.c_str());
|
||||
|
||||
NSPresentationEditor::CColor color = NS_DWC_Common::getColorFromString(strColor);
|
||||
PPTX::Logic::UniColor *oColor = new PPTX::Logic::UniColor();
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -123,6 +125,19 @@ namespace NSBinPptxRW
|
||||
m_lIndexNextImage = 0;
|
||||
m_lIndexCounter = 0;
|
||||
}
|
||||
void CImageManager2::SetDstFolder(const std::wstring& strDst)
|
||||
{
|
||||
m_strDstFolder = strDst;
|
||||
m_strDstMedia = m_strDstFolder + FILE_SEPARATOR_STR + _T("media");
|
||||
m_strDstEmbed = m_strDstFolder + FILE_SEPARATOR_STR + _T("embeddings");
|
||||
|
||||
NSDirectory::CreateDirectory(m_strDstMedia);
|
||||
NSDirectory::CreateDirectory(m_strDstEmbed);
|
||||
}
|
||||
std::wstring CImageManager2::GetDstFolder()
|
||||
{
|
||||
return m_strDstFolder;
|
||||
}
|
||||
void CImageManager2::SetDstMedia(const std::wstring& strDst)
|
||||
{
|
||||
m_strDstMedia = strDst;
|
||||
@ -1220,7 +1235,7 @@ namespace NSBinPptxRW
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::EndPresentationRels(const bool& bIsCommentsAuthors = false, const bool& bIsNotesMaster)
|
||||
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject)
|
||||
{
|
||||
if (bIsNotesMaster)
|
||||
{
|
||||
@ -1245,6 +1260,12 @@ namespace NSBinPptxRW
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors\" Target=\"commentAuthors.xml\"/>";
|
||||
m_pWriter->WriteString(strRels4);
|
||||
}
|
||||
if (bIsVbaProject)
|
||||
{
|
||||
std::wstring strRels4 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
|
||||
L"\" Type=\"http://schemas.microsoft.com/office/2006/relationships/vbaProject\" Target=\"vbaProject.bin\"/>";
|
||||
m_pWriter->WriteString(strRels4);
|
||||
}
|
||||
}
|
||||
int CRelsGenerator::GetNextId()
|
||||
{
|
||||
|
||||
@ -178,8 +178,10 @@ namespace NSBinPptxRW
|
||||
std::map<std::wstring, _imageManager2Info> m_mapImages;
|
||||
_INT32 m_lIndexNextImage;
|
||||
_INT32 m_lIndexCounter;
|
||||
|
||||
std::wstring m_strDstMedia;
|
||||
std::wstring m_strDstEmbed;
|
||||
std::wstring m_strDstFolder;
|
||||
public:
|
||||
int m_nDocumentType;
|
||||
OOX::CContentTypes* m_pContentTypes;
|
||||
@ -194,6 +196,9 @@ namespace NSBinPptxRW
|
||||
void SetDstEmbed(const std::wstring& strDst);
|
||||
std::wstring GetDstEmbed();
|
||||
|
||||
void SetDstFolder(const std::wstring& strDst);
|
||||
std::wstring GetDstFolder();
|
||||
|
||||
int IsDisplayedImage(const std::wstring& strInput);
|
||||
|
||||
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
@ -419,8 +424,8 @@ namespace NSBinPptxRW
|
||||
int WriteChart (int nChartNumber, _INT32 lDocType);
|
||||
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
|
||||
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
|
||||
|
||||
void EndPresentationRels (const bool& bIsCommentsAuthors, const bool& bIsNotesMaster = false);
|
||||
|
||||
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false );
|
||||
int GetNextId ();
|
||||
void CloseRels ();
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -2122,6 +2122,8 @@ namespace NSGuidesVML
|
||||
|
||||
for (size_t nIndex = 0; nIndex < oArray.size(); ++nIndex)
|
||||
{
|
||||
if (oPath.m_arParts.size() <= nIndex)
|
||||
break;
|
||||
const CPartPath& oPart = oPath.m_arParts[nIndex];
|
||||
m_lWidth = oPart.width;
|
||||
m_lHeight = oPart.height;
|
||||
|
||||
@ -100,7 +100,9 @@ namespace NSBinPptxRW
|
||||
|
||||
m_oImageManager.Clear();
|
||||
|
||||
OOX::CPath pathMedia = pathPPT / _T("media");
|
||||
m_oImageManager.SetDstFolder(pathPPT.GetPath());
|
||||
|
||||
OOX::CPath pathMedia = pathPPT / _T("media");
|
||||
NSDirectory::CreateDirectory(pathMedia.GetPath());
|
||||
|
||||
m_oImageManager.SetDstMedia(pathMedia.GetPath());
|
||||
@ -809,7 +811,8 @@ namespace NSBinPptxRW
|
||||
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
|
||||
++nCurrentRels;
|
||||
}
|
||||
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent);
|
||||
|
||||
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init());
|
||||
m_oReader.m_pRels->CloseRels();
|
||||
|
||||
oXmlWriter.ClearNoAttack();
|
||||
@ -840,7 +843,16 @@ namespace NSBinPptxRW
|
||||
// content types
|
||||
OOX::CContentTypes *pContentTypes = m_oImageManager.m_pContentTypes;
|
||||
|
||||
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml", L"/ppt", L"presentation.xml");
|
||||
pContentTypes->Registration(m_oPresentation.type().OverrideType(),
|
||||
m_oPresentation.type().DefaultDirectory(),
|
||||
m_oPresentation.type().DefaultFileName());
|
||||
|
||||
if (m_oPresentation.m_pVbaProject.IsInit())
|
||||
{
|
||||
pContentTypes->Registration(m_oPresentation.m_pVbaProject->type().OverrideType(),
|
||||
m_oPresentation.type().DefaultDirectory() / m_oPresentation.m_pVbaProject->type().DefaultDirectory(),
|
||||
m_oPresentation.m_pVbaProject->type().DefaultFileName());
|
||||
}
|
||||
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml", L"/ppt", L"presProps.xml");
|
||||
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml", L"/ppt", L"viewProps.xml");
|
||||
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml", L"/ppt", L"tableStyles.xml");
|
||||
|
||||
@ -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
|
||||
@ -84,7 +84,8 @@ namespace PPTX
|
||||
return smart_ptr<OOX::File>(new PPTX::App(filename, map));
|
||||
else if (relation.Type() == OOX::FileTypes::Core)
|
||||
return smart_ptr<OOX::File>(new PPTX::Core(filename, map));
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation)
|
||||
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation ||
|
||||
relation.Type() == OOX::Presentation::FileTypes::PresentationMacro)
|
||||
return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map));
|
||||
else if (relation.Type() == OOX::FileTypes::Theme)
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme(filename, map));
|
||||
@ -141,6 +142,8 @@ namespace PPTX
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject(filename));
|
||||
else if (relation.Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
|
||||
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
|
||||
else if (relation.Type() == OOX::FileTypes::VbaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( filename, filename ));
|
||||
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
|
||||
}
|
||||
|
||||
@ -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_
|
||||
|
||||
@ -44,6 +44,9 @@ namespace Presentation
|
||||
const FileType Presentation (L"ppt", L"presentation.xml",
|
||||
_T("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
|
||||
const FileType PresentationMacro(L"ppt", L"presentation.xml",
|
||||
_T("application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
|
||||
const FileType Slide (L"slides", L"slide.xml",
|
||||
_T("application/vnd.openxmlformats-officedocument.presentationml.slide+xml"),
|
||||
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"));
|
||||
|
||||
@ -75,6 +75,12 @@ namespace PPTX
|
||||
if (_presentation.is_init())
|
||||
{
|
||||
_presentation->commentAuthors = _presentation->Get(OOX::Presentation::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>();
|
||||
|
||||
if (_presentation->IsExist(OOX::FileTypes::VbaProject))
|
||||
{
|
||||
_presentation->m_bMacroEnabled = true;
|
||||
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
|
||||
}
|
||||
}
|
||||
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -118,6 +118,8 @@ namespace PPTX
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*embed);
|
||||
return _T("");
|
||||
}
|
||||
else if(link.IsInit())
|
||||
@ -137,6 +139,8 @@ namespace PPTX
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
return parentFileAs<NotesSlide>().GetMediaFullPathNameFromRId(*link);
|
||||
return _T("");
|
||||
}
|
||||
return _T("");
|
||||
@ -150,6 +154,7 @@ namespace PPTX
|
||||
else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().GetOleObject(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().GetOleObject(oRId);
|
||||
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().GetOleObject(oRId);
|
||||
else if(parentFileIs<NotesSlide>()) pOleObject = parentFileAs<NotesSlide>().GetOleObject(oRId);
|
||||
|
||||
if (pOleObject.IsInit())
|
||||
return pOleObject->filename().m_strFilename;
|
||||
|
||||
@ -64,6 +64,8 @@ namespace PPTX
|
||||
sLink = parentFileAs<SlideMaster>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<Theme>())
|
||||
sLink = parentFileAs<Theme>().GetFullHyperlinkNameFromRId(rid);
|
||||
else if(parentFileIs<NotesSlide>())
|
||||
sLink = parentFileAs<NotesSlide>().GetFullHyperlinkNameFromRId(rid);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all(sLink, L"\\", L"/");
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -165,23 +166,28 @@ namespace PPTX
|
||||
pWriter->WriteBYTE(1);
|
||||
pWriter->EndRecord();
|
||||
|
||||
DocWrapper::FontProcessor fp;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
DocWrapper::FontProcessor oFontProcessor;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
BinDocxRW::CDocxSerializer oDocxSerializer;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
BinDocxRW::CDocxSerializer* old_serial = pWriter->m_pMainDocument;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(pWriter, &oFontProcessor, &oDrawingConverter, NULL);
|
||||
|
||||
BinDocxRW::ParamsWriter oParamsWriter(pWriter, &fp, &oDrawingConverter, NULL);
|
||||
BinDocxRW::BinaryFileWriter oBinaryFileWriter(oParamsWriter);
|
||||
pWriter->m_pMainDocument = &oDocxSerializer;
|
||||
|
||||
BinDocxRW::BinaryFileWriter oBinaryFileWriter(*oDocxSerializer.m_pParamsWriter);
|
||||
|
||||
pWriter->StartRecord(2);
|
||||
oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath());
|
||||
pWriter->EndRecord();
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
pWriter->m_pMainDocument = old_serial;
|
||||
}
|
||||
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX)
|
||||
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!
|
||||
@ -367,7 +373,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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -88,7 +88,33 @@ namespace PPTX
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = GetImage(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetFullHyperlinkNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::HyperLink> p = GetHyperlink(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->Uri().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
//return relsTable.Links.GetTargetById(rid);
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(NSBinPptxRW::NSMainTables::NotesSlides);
|
||||
|
||||
@ -50,6 +50,8 @@
|
||||
#include "Logic/ExtP.h"
|
||||
#include "Theme/ClrScheme.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Presentation : public WrapperFile, public PPTX::FileContainer
|
||||
@ -57,16 +59,16 @@ namespace PPTX
|
||||
public:
|
||||
Presentation()
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
}
|
||||
Presentation(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
read(filename, map);
|
||||
}
|
||||
virtual ~Presentation()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
//FileContainer::read(filename, map);
|
||||
@ -182,6 +184,7 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//smartTags (Smart Tags)
|
||||
Normalize();
|
||||
}
|
||||
@ -222,6 +225,15 @@ namespace PPTX
|
||||
pWriter->WriteRecord2(6, commentAuthors);
|
||||
pWriter->WriteRecord2(7, sectionLst);
|
||||
|
||||
if (m_pVbaProject.IsInit())
|
||||
{
|
||||
pWriter->StartRecord(8);
|
||||
{
|
||||
m_pVbaProject->toPPTY(pWriter);
|
||||
}
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
@ -318,22 +330,28 @@ namespace PPTX
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
commentAuthors = new PPTX::Authors();
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
}break;
|
||||
case 7:
|
||||
{
|
||||
sectionLst = new nsPresentation::SectionLst();
|
||||
sectionLst->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
sectionLst->fromPPTY(pReader);
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
m_pVbaProject = new OOX::VbaProject();
|
||||
m_pVbaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pVbaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
|
||||
m_bMacroEnabled = true;
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->Seek(_end_pos);
|
||||
@ -397,10 +415,10 @@ namespace PPTX
|
||||
pWriter->EndNode(L"p:presentation");
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Presentation::FileTypes::Presentation;
|
||||
if (m_bMacroEnabled) return OOX::Presentation::FileTypes::PresentationMacro;
|
||||
else return OOX::Presentation::FileTypes::Presentation;
|
||||
}
|
||||
virtual const OOX::CPath DefaultDirectory() const
|
||||
{
|
||||
@ -411,7 +429,6 @@ namespace PPTX
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
|
||||
public:
|
||||
//Childs
|
||||
//custDataLst (Customer Data List)
|
||||
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
|
||||
@ -446,9 +463,12 @@ namespace PPTX
|
||||
smart_ptr<PPTX::Authors> commentAuthors;
|
||||
|
||||
private:
|
||||
Logic::ClrMap m_clrMap;
|
||||
nsTheme::ClrScheme m_clrScheme;
|
||||
Logic::ClrMap m_clrMap;
|
||||
nsTheme::ClrScheme m_clrScheme;
|
||||
public:
|
||||
bool m_bMacroEnabled;
|
||||
smart_ptr<OOX::VbaProject> m_pVbaProject;
|
||||
|
||||
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;};
|
||||
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;};
|
||||
|
||||
|
||||
@ -363,7 +363,7 @@ namespace PPTX
|
||||
}
|
||||
if (IsExist(OOX::FileTypes::VmlDrawing))
|
||||
{
|
||||
Vml = FileContainer::Get(OOX::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();//boost::shared_dynamic_cast<PPTX::VmlDrawing, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::VmlDrawing));
|
||||
Vml = FileContainer::Get(OOX::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;"../../DesktopEditor/freetype-2.5.2/include""
|
||||
AdditionalIncludeDirectories=""../../DesktopEditor/freetype-2.5.2/include";../../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;"..\..\DesktopEditor\freetype-2.5.2\include""
|
||||
AdditionalIncludeDirectories=""..\..\DesktopEditor\freetype-2.5.2\include""
|
||||
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"
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include "../RtfMath.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
#include "../../../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
|
||||
class OOXMathReader
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -146,7 +146,7 @@ bool OOXWriter::SaveByItemEnd()
|
||||
if (m_poDocPropsApp)
|
||||
{
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" );
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( L"4.3" );
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( L"5.0" );
|
||||
|
||||
((OOX::CApp*)m_poDocPropsApp)->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", pathDocProps.GetDirectory(), oContentTypes);
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(_T("OnlyOffice"));
|
||||
pApp->SetAppVersion(_T("4.3000"));
|
||||
pApp->SetAppVersion(_T("5.0"));
|
||||
pApp->SetDocSecurity(0);
|
||||
pApp->SetScaleCrop(false);
|
||||
pApp->SetLinksUpToDate(false);
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;"D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include""
|
||||
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;"D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include""
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@ -46,7 +46,10 @@ BiffStructurePtr XFExtGradient::clone()
|
||||
void XFExtGradient::load(CFRecord& record)
|
||||
{
|
||||
record >> gradient >> cGradStops;
|
||||
for(size_t i = 0; i < cGradStops; ++i)
|
||||
|
||||
if (cGradStops > 256) cGradStops = 256;
|
||||
|
||||
for(size_t i = 0; !record.isEOF() && i < cGradStops; ++i)
|
||||
{
|
||||
GradStop grad_stop;
|
||||
record >> grad_stop;
|
||||
|
||||
@ -61,8 +61,10 @@ void XFExtNoFRT::load(CFRecord& record)
|
||||
unsigned short cexts;
|
||||
record >> cexts;
|
||||
|
||||
for(unsigned short i = 0; !record.isEOF() && i < cexts; ++i)
|
||||
for(unsigned short i = 0; i < cexts; ++i)
|
||||
{
|
||||
if (record.checkFitReadSafe(4) == false)
|
||||
break;
|
||||
ExtProp prop;
|
||||
record >> prop;
|
||||
rgExt.push_back(prop);
|
||||
|
||||
@ -249,17 +249,12 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
// CP_XML_ATTR(L"containsString", 0);
|
||||
// }
|
||||
//}
|
||||
if (bInteger)
|
||||
{
|
||||
if (bNumber) bInteger = false;
|
||||
else bNumber = true;
|
||||
}
|
||||
|
||||
if ((bDate & bNumber) || (bNumber & bString))
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
|
||||
}
|
||||
else if ( bDate & bString)
|
||||
else if (bDate & bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
}
|
||||
@ -277,9 +272,22 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
CP_XML_ATTR(L"containsString", 0);
|
||||
}
|
||||
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
|
||||
|
||||
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
|
||||
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
|
||||
|
||||
if (bInteger && !bDate)
|
||||
{
|
||||
if (bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
else if (!bNumber)
|
||||
{
|
||||
CP_XML_ATTR(L"containsNumber", 1);
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fdb->fnumMinMaxValid)
|
||||
{
|
||||
|
||||
@ -141,8 +141,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
{
|
||||
case rt_Uncalced: proc.optional<Uncalced>(); break;
|
||||
case rt_Index: proc.optional<Index>(); break;
|
||||
case rt_CalcRefMode:
|
||||
case rt_CalcRefMode://todooo сделать вариативно по всем проверку
|
||||
case rt_CalcMode:
|
||||
case rt_PrintRowCol:
|
||||
{
|
||||
GLOBALS globals(false);
|
||||
if (proc.mandatory(globals))
|
||||
@ -221,6 +222,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_LabelSst://order_history.xls
|
||||
case rt_Label://file(6).xls
|
||||
case rt_Row:
|
||||
{
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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->());
|
||||
|
||||
// Ищем файл с наcтройками
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
#define OOX_FILE_INCLUDE_H_
|
||||
|
||||
#include "../XML/XmlSimple.h"
|
||||
#include "../SystemUtility/SystemUtility.h"
|
||||
|
||||
#include "FileType.h"
|
||||
#include "ContentTypes.h"
|
||||
|
||||
@ -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() );
|
||||
}
|
||||
|
||||
@ -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"));
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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 )
|
||||
}
|
||||
|
||||
|
||||
239
Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h
Normal file
239
Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h
Normal 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_
|
||||
@ -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
|
||||
{
|
||||
|
||||
125
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Normal file
125
Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* (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 "../../../../../ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h"
|
||||
#include "../../../../../ASCOfficePPTXFile/Editor/imagemanager.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();
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
pWriter->WriteString1(0, m_filename.GetFilename());
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
copy_to(pWriter->m_pCommon->m_pImageManager->m_strDstMedia);
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // start attributes
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
std::wstring file_name = pReader->GetString2();
|
||||
|
||||
OOX::CPath inputPath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + file_name;
|
||||
OOX::CPath outputPath = pReader->m_pRels->m_pManager->GetDstFolder() + FILE_SEPARATOR_STR + _T("vbaProject.bin");
|
||||
|
||||
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
|
||||
|
||||
set_filename(outputPath.GetPath());
|
||||
|
||||
}break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
protected:
|
||||
};
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_VBA_PROJECT_INCLUDE_H_
|
||||
@ -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,
|
||||
|
||||
395
Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h
Normal file
395
Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h
Normal 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_
|
||||
@ -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() );
|
||||
}
|
||||
|
||||
@ -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"));
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -66,6 +66,7 @@ core_mac {
|
||||
core_windows {
|
||||
CONFIG -= debug_and_release debug_and_release_target
|
||||
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
|
||||
QMAKE_CXXFLAGS += /MP
|
||||
}
|
||||
|
||||
core_win_32 {
|
||||
|
||||
@ -195,7 +195,7 @@ public:
|
||||
_LOGGING_ERROR_(L"execute_compile_code", strCode);
|
||||
_LOGGING_ERROR_(L"execute_compile", strException);
|
||||
|
||||
return false;
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -209,7 +209,7 @@ public:
|
||||
_LOGGING_ERROR_(L"execute_run_code", strCode);
|
||||
_LOGGING_ERROR_(L"execute_run", strException);
|
||||
|
||||
return false;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (_value->IsString())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -674,12 +674,20 @@ public:
|
||||
|
||||
m_nLen = read_int2(pData, nCur, nLen);
|
||||
|
||||
m_pData = new BYTE[m_nLen];
|
||||
m_pDataCur = m_pData;
|
||||
if (nVersion < 10)
|
||||
{
|
||||
m_pData = new BYTE[m_nLen];
|
||||
m_pDataCur = m_pData;
|
||||
read_base64_2(pData, nCur, nLen);
|
||||
|
||||
read_base64_2(pData, nCur, nLen);
|
||||
|
||||
delete[]pData;
|
||||
delete[]pData;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nLen = nLen;
|
||||
m_pData = (BYTE*)pData;
|
||||
m_pDataCur = m_pData + m_nLen;
|
||||
}
|
||||
|
||||
return nVersion;
|
||||
}
|
||||
|
||||
@ -189,13 +189,15 @@ static const struct ActionNamesEmf
|
||||
|
||||
do
|
||||
{
|
||||
if (m_oStream.CanRead() < 8)
|
||||
if (m_oStream.IsEof())
|
||||
break;
|
||||
if (m_oStream.CanRead() < 8)
|
||||
return SetError();
|
||||
|
||||
m_oStream >> ulType;
|
||||
m_oStream >> ulSize;
|
||||
|
||||
if (ulSize < 1)
|
||||
if (ulSize < 1)
|
||||
continue;
|
||||
|
||||
m_ulRecordPos = m_oStream.Tell();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user