Compare commits

...

43 Commits

Author SHA1 Message Date
65e7372cf7 Merge remote-tracking branch 'origin/release/v5.0.0' into develop 2017-08-18 16:07:56 +03:00
2ce5708599 Odf, xls, doc - fix users files 2017-08-18 15:51:55 +03:00
1ea27ad7f8 Added multithread flag 2017-08-18 15:45:06 +03:00
48d94d24eb cache xlsx file to support pivot in xls, ods...; don't send jwt signature; and save in doctrenderer; 2017-08-18 14:49:56 +03:00
f5c569ab2a DocFormatReader ... 2017-08-18 12:01:45 +03:00
2e61fcfdd9 read/write pptm 2017-08-17 20:18:57 +03:00
3df883cbe8 return errors 2017-08-17 09:38:03 +03:00
0ed3f740b7 read/write docm 2017-08-16 18:05:59 +03:00
af2e76aea6 OdfFormatWriter - fix convert notes 2017-08-16 16:21:19 +03:00
6593230d48 . 2017-08-15 19:56:00 +03:00
e02c72b564 x2t version up. read/write xlsm. 2017-08-15 17:23:17 +03:00
c2964f92af . 2017-08-15 16:10:34 +03:00
15fb3a4f4e Revert "."
This reverts commit cff1836571.
2017-08-15 16:09:09 +03:00
cff1836571 . 2017-08-15 16:08:40 +03:00
cb57db3c8a . 2017-08-15 16:05:27 +03:00
d22fb105b6 OoxFormat - vbaProject, ... 2017-08-15 15:18:28 +03:00
89aba918bc OoxFormat - read/write vbaProject in binary 2017-08-14 19:24:21 +03:00
47c1e6f637 Merge branch 'develop' of github.com:ONLYOFFICE/core into develop 2017-08-14 16:36:45 +03:00
f5284c967b . 2017-08-14 16:32:41 +03:00
d465e29a0f v4.4.3 2017-08-14 16:30:52 +03:00
f43ef621cb OoxFormat - add vba & activeX controls 2017-08-14 16:26:30 +03:00
2f9a8eb77f OdfFormatReader - pilots converting .. 2017-08-11 09:47:20 +03:00
a70087e1f2 no base 64 data 2017-08-09 19:44:57 +03:00
c3da9a66a1 OdfFormatReader - convert pilots ... 2017-08-09 18:23:25 +03:00
f907a90be7 . 2017-08-09 18:22:42 +03:00
f65a27cf86 Build the v8 in multithreaded mode 2017-08-09 17:06:52 +03:00
ed59c2b998 . 2017-08-09 14:55:02 +03:00
925bca7149 OdfFormatWriter - small refactoring, fix chart size (from xls) 2017-08-09 13:36:00 +03:00
c9f2315186 CASCHTMLRenderer3 CloseFile IsNoBase64 2017-08-08 19:05:58 +03:00
5818f4997b htmlrenderer no base64 2017-08-08 18:59:16 +03:00
691042c507 OdfFormatReader - convert pilot tables 2017-08-08 18:24:33 +03:00
d8f34224ca OdfFormatReader - pilot tables 2017-08-08 15:02:07 +03:00
dfe4541f43 . 2017-08-08 12:37:40 +03:00
3fa3a52c89 . 2017-08-07 17:14:41 +03:00
665783a6c5 palette alpha 2017-08-07 15:27:24 +03:00
0b15c31487 fix bug #35485 2017-08-07 15:12:14 +03:00
44fdbf6df4 OdfFormatWriter - fix notes layouts 2017-08-07 14:00:23 +03:00
582fce4ca1 fix bug #35466 2017-08-07 11:13:27 +03:00
bde723c5cb internal onlyoffice field for comment time 2017-08-03 15:08:01 +03:00
97fb316248 internal onlyoffice field for comment time 2017-08-03 15:07:11 +03:00
a607282285 refactoring... 2017-08-02 17:27:41 +03:00
62ea2bbc46 Editor.bin without base64 2017-07-27 14:49:57 +03:00
89ce79dafc v4.4.2 2017-07-24 15:25:00 +03:00
190 changed files with 6620 additions and 2598 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\Common\OfficeDrawing;&quot;..\..\..\..\..\DesktopEditor\freetype-2.5.2\include&quot;;..\..\..\..\..\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"

View File

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

View File

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

View File

@ -1583,6 +1583,7 @@ public:
std::wstring UserName;
std::wstring UserId;
std::wstring Date;
std::wstring OOData;
bool Solved;
std::wstring Text;
std::wstring m_sParaId;
@ -1706,9 +1707,16 @@ public:
{
std::wstring sDate = XmlUtils::EncodeXmlString(pComment->Date);
sRes += L" w:date=\"";
sRes += sDate;
sRes += sDate;
sRes += L"\"";
}
if(false == pComment->OOData.empty())
{
std::wstring sData = XmlUtils::EncodeXmlString(pComment->OOData);
sRes += L" oodata=\"";
sRes += sData;
sRes += L"\"";
}
if(false == sInitials.empty())
{
sInitials = XmlUtils::EncodeXmlString(sInitials);

View File

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

View File

@ -273,6 +273,21 @@ private:
return res;
}
};
class Binary_VbaProjectTableReader : public Binary_CommonReader<Binary_VbaProjectTableReader>
{
Writers::FileWriter& m_oFileWriter;
public:
Binary_VbaProjectTableReader (NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Read ();
int ReadContent (BYTE type, long length, void* poResult);
};
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
{
Writers::FileWriter& m_oFileWriter;
@ -282,12 +297,12 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe
int nCurHeaderType;
public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public:
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
int Read();
int ReadHdrFtrContent(BYTE type, long length, void* poResult);
int ReadHdrFtrFEO(BYTE type, long length, void* poResult);
int ReadHdrFtrItem(BYTE type, long length, void* poResult);
int ReadHdrFtrContent (BYTE type, long length, void* poResult);
int ReadHdrFtrFEO (BYTE type, long length, void* poResult);
int ReadHdrFtrItem (BYTE type, long length, void* poResult);
int ReadHdrFtrItemContent(BYTE type, long length, void* poResult);
};
class Binary_rPrReader : public Binary_CommonReader<Binary_rPrReader>
@ -551,7 +566,7 @@ public:
std::wstring strXml;
HRESULT hRes = m_oFileWriter.m_pDrawingConverter->GetRecordXml(nCurPos, length, XMLWRITER_RECORD_TYPE_TEXT_FILL, XMLWRITER_DOC_TYPE_WORDART, strXml);
if (S_OK == hRes)
orPr->Fill = _T("<w14:textFill>") + strXml + _T("</w14:textFill>");
orPr->Fill = L"<w14:textFill>" + strXml + L"</w14:textFill>";
m_oBufferedStream.Seek(nCurPos + length);
}
}
@ -560,35 +575,35 @@ public:
{
TrackRevision oDel;
oBinary_CommonReader2.ReadTrackRevision(length, &oDel);
orPr->Del = oDel.ToString(_T("w:del"));
orPr->Del = oDel.ToString(L"w:del");
}
break;
case c_oSerProp_rPrType::Ins:
{
TrackRevision oIns;
oBinary_CommonReader2.ReadTrackRevision(length, &oIns);
orPr->Ins = oIns.ToString(_T("w:ins"));
orPr->Ins = oIns.ToString(L"w:ins");
}
break;
case c_oSerProp_rPrType::MoveFrom:
{
TrackRevision oMoveFrom;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveFrom);
orPr->MoveFrom = oMoveFrom.ToString(_T("w:moveFrom"));
orPr->MoveFrom = oMoveFrom.ToString(L"w:moveFrom");
}
break;
case c_oSerProp_rPrType::MoveTo:
{
TrackRevision oMoveTo;
oBinary_CommonReader2.ReadTrackRevision(length, &oMoveTo);
orPr->MoveTo = oMoveTo.ToString(_T("w:moveTo"));
orPr->MoveTo = oMoveTo.ToString(L"w:moveTo");
}
break;
case c_oSerProp_rPrType::rPrChange:
{
TrackRevision oRPrChange;
res = Read1(length, &Binary_rPrReader::ReadrPrChange, this, &oRPrChange);
orPr->rPrChange = oRPrChange.ToString(_T("w:rPrChange"));
orPr->rPrChange = oRPrChange.ToString(L"w:rPrChange");
}
break;
default:
@ -647,9 +662,9 @@ public:
{
BYTE contextualSpacing = m_oBufferedStream.GetUChar();
if(0 != contextualSpacing)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"true\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"true\"/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:contextualSpacing w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:contextualSpacing w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::Ind:
{
@ -657,9 +672,9 @@ public:
res = Read2(length, &Binary_pPrReader::ReadInd, this, &oTempWriter);
if(oTempWriter.GetCurSize() > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:ind")));
pCStringWriter->WriteString(std::wstring(L"<w:ind"));
pCStringWriter->Write(oTempWriter);
pCStringWriter->WriteString(std::wstring(_T("/>")));
pCStringWriter->WriteString(std::wstring(L"/>"));
}
break;
}
@ -668,35 +683,35 @@ public:
BYTE jc = m_oBufferedStream.GetUChar();
switch(jc)
{
case align_Right: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"right\" />")));break;
case align_Left: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"left\" />")));break;
case align_Center: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"center\" />")));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(_T("<w:jc w:val=\"both\" />")));break;
case align_Right: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"right\" />"));break;
case align_Left: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"left\" />"));break;
case align_Center: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"center\" />"));break;
case align_Justify: pCStringWriter->WriteString(std::wstring(L"<w:jc w:val=\"both\" />"));break;
}
}break;
case c_oSerProp_pPrType::KeepLines:
{
BYTE KeepLines = m_oBufferedStream.GetUChar();
if(0 != KeepLines)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepLines/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepLines w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepLines w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::KeepNext:
{
BYTE KeepNext = m_oBufferedStream.GetUChar();
if(0 != KeepNext)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepNext/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:keepNext w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:keepNext w:val=\"false\"/>"));
}break;
case c_oSerProp_pPrType::PageBreakBefore:
{
BYTE pageBreakBefore = m_oBufferedStream.GetUChar();
if(0 != pageBreakBefore)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore/>")));
pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore/>"));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:pageBreakBefore w:val=\"false\"/>")));
pCStringWriter->WriteString(std::wstring(L"<w:pageBreakBefore w:val=\"false\"/>"));
break;
}
case c_oSerProp_pPrType::Spacing:
@ -705,7 +720,7 @@ public:
res = Read2(length, &Binary_pPrReader::ReadSpacing, this, &oSpacing);
if(oSpacing.bLine || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto)
{
pCStringWriter->WriteString(std::wstring(_T("<w:spacing")));
pCStringWriter->WriteString(std::wstring(L"<w:spacing"));
BYTE bLineRule = linerule_Auto;
//проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line
if(oSpacing.bLine)
@ -745,9 +760,9 @@ public:
if(oSpacing.bAfterAuto)
{
if(true == oSpacing.AfterAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"1\""));
else
pCStringWriter->WriteString(std::wstring(_T(" w:afterAutospacing=\"0\"")));
pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"0\""));
}
if(oSpacing.bBefore)
{
@ -758,11 +773,11 @@ public:
if(oSpacing.bBeforeAuto)
{
if(true == oSpacing.BeforeAuto)
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"1\"")));
pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"1\""));
else
pCStringWriter->WriteString(std::wstring(_T(" w:beforeAutospacing=\"0\"")));
pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"0\""));
}
pCStringWriter->WriteString(std::wstring(_T("/>")));
pCStringWriter->WriteString(std::wstring(L"/>"));
}
break;
}
@ -776,7 +791,7 @@ public:
}
else
{
std::wstring sShd(_T("<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>"));
std::wstring sShd(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>");
pCStringWriter->WriteString(sShd);
}
break;
@ -787,10 +802,10 @@ public:
if(0 != WidowControl)
{
if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl/>")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl/>"));
}
else
pCStringWriter->WriteString(std::wstring(_T("<w:widowControl w:val=\"off\" />")));
pCStringWriter->WriteString(std::wstring(L"<w:widowControl w:val=\"off\" />"));
break;
}
case c_oSerProp_pPrType::Tab:
@ -800,7 +815,7 @@ public:
size_t nLen = oTabs.m_aTabs.size();
if(nLen > 0)
{
pCStringWriter->WriteString(std::wstring(_T("<w:tabs>")));
pCStringWriter->WriteString(std::wstring(L"<w:tabs>"));
for(size_t i = 0; i < nLen; ++i)
{
Tab& oTab = oTabs.m_aTabs[i];
@ -808,14 +823,14 @@ public:
std::wstring sVal;
switch(oTab.Val)
{
case g_tabtype_right: sVal=_T("right"); break;
case g_tabtype_center: sVal=_T("center"); break;
case g_tabtype_clear: sVal=_T("clear"); break;
default: sVal=_T("left"); break;
case g_tabtype_right: sVal = L"right"; break;
case g_tabtype_center: sVal = L"center"; break;
case g_tabtype_clear: sVal = L"clear"; break;
default: sVal = L"left"; break;
}
pCStringWriter->WriteString(L"<w:tab w:val=\"" + sVal + L"\" w:pos=\"" + std::to_wstring(nTab) + L"\"/>");
}
pCStringWriter->WriteString(std::wstring(_T("</w:tabs>")));
pCStringWriter->WriteString(std::wstring(L"</w:tabs>"));
}
}break;
case c_oSerProp_pPrType::ParaStyle:
@ -826,9 +841,9 @@ public:
}break;
case c_oSerProp_pPrType::numPr:
{
pCStringWriter->WriteString(std::wstring(_T("<w:numPr>")));
pCStringWriter->WriteString(std::wstring(L"<w:numPr>"));
res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult);
pCStringWriter->WriteString(std::wstring(_T("</w:numPr>")));
pCStringWriter->WriteString(std::wstring(L"</w:numPr>"));
}break;
case c_oSerProp_pPrType::pPr_rPr:
{
@ -2917,7 +2932,8 @@ class Binary_OtherTableReader : public Binary_CommonReader<Binary_OtherTableRead
Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir;
public:
Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):m_sFileInDir(sFileInDir),Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter)
Binary_OtherTableReader(std::wstring sFileInDir, NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: m_sFileInDir(sFileInDir), Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Read()
@ -3039,6 +3055,11 @@ public:
std::wstring Date(m_oBufferedStream.GetString3(length));
pComment->Date = Date;
}
else if ( c_oSer_CommentsType::OOData == type )
{
std::wstring Data(m_oBufferedStream.GetString3(length));
pComment->OOData = Data;
}
else if ( c_oSer_CommentsType::Text == type )
{
std::wstring Text(m_oBufferedStream.GetString3(length));
@ -7017,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;
@ -7917,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;
@ -7956,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
@ -8082,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);
}
@ -8135,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:
@ -8160,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");
@ -8170,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)
@ -8191,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);
@ -8203,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);
@ -8211,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;
@ -8227,19 +8262,19 @@ public:
if(false == oCommentsWriter.m_sComment.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments")), std::wstring(_T("comments.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
}
if(false == oCommentsWriter.m_sCommentExt.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/commentsExtended")), std::wstring(_T("commentsExtended.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
}
if(false == oCommentsWriter.m_sPeople.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/people")), std::wstring(_T("people.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
}

View File

@ -125,6 +125,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
const static wchar_t* g_sFormatSignature = L"DOCY";
const int g_nFormatVersion = 5;
const int g_nFormatVersionNoBase64 = 10;
extern int g_nCurFormatVersion;
namespace c_oAscWrapStyle{enum c_oSerFormat
{
@ -141,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
{
@ -202,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
{
@ -520,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,
@ -715,7 +721,8 @@ extern int g_nCurFormatVersion;
Text = 6,
QuoteText = 7,
Solved = 8,
Replies = 9
Replies = 9,
OOData = 10
};}
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
{

View File

@ -82,11 +82,11 @@ namespace BinDocxRW
int m_nType;
public:
std::wstring m_sFld;
public: FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
public: int GetType()
{
return m_nType;
}
FldStruct(std::wstring sFld, int nType):m_sFld(sFld),m_nType(nType){}
int GetType()
{
return m_nType;
}
};
class BinaryCommonWriter
{
@ -3027,6 +3027,26 @@ namespace BinDocxRW
}
pOfficeDrawingConverter->SetRels(oldRels);
}
void WriteVbaProjectContent(OOX::VbaProject& oVbaProject)
{
std::wstring file_name = oVbaProject.filename().GetFilename();
m_oBcw.m_oStream.WriteBYTE(c_oSerVbaProjectTypes::Name);
m_oBcw.m_oStream.WriteStringW(file_name);
//... todooo write parsing vba project
//write vbaData.... todooo
//copy file bin
oVbaProject.copy_to(m_oBcw.m_oStream.m_pCommon->m_pImageManager->m_strDstMedia);
}
void WriteVbaProject(OOX::VbaProject& oVbaProject)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteVbaProjectContent(oVbaProject);
m_oBcw.WriteItemWithLengthEnd(nStart);
}
void Write(std::vector<OOX::WritingElement*>& aElems)
{
int nStart = m_oBcw.WriteItemWithLengthStart();
@ -7222,6 +7242,11 @@ namespace BinDocxRW
m_oBcw.m_oStream.WriteBYTE(c_oSer_CommentsType::Date);
m_oBcw.m_oStream.WriteStringW(pComment->m_oDate->ToString());
}
if(pComment->m_oOOData.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_CommentsType::OOData);
m_oBcw.m_oStream.WriteStringW(pComment->m_oOOData.get2());
}
if(pComment->m_oId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Id);
@ -7714,9 +7739,9 @@ namespace BinDocxRW
m_nLastFilePos = 0;
m_nRealTableCount = 0;
}
static std::wstring WriteFileHeader(long nDataSize)
static std::wstring WriteFileHeader(long nDataSize, int version)
{
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(g_nFormatVersion) + L";" + std::to_wstring(nDataSize) + L";";
std::wstring sHeader = std::wstring(g_sFormatSignature) + L";v" + std::to_wstring(version) + L";" + std::to_wstring(nDataSize) + L";";
return sHeader;
}
void WriteMainTableStart()
@ -7861,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);
@ -7871,7 +7895,15 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if(NULL != oDocx.m_pVbaProject)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
// Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
this->WriteTableEnd(nCurPos);

View File

@ -47,6 +47,7 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
m_pCurFileWriter = NULL;
m_bIsNoBase64Save = false;
m_bIsNoBase64 = false;
m_bSaveChartAsImg = false;
}
BinDocxRW::CDocxSerializer::~CDocxSerializer()
@ -54,52 +55,6 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
RELEASEOBJECT(m_pParamsWriter);
RELEASEOBJECT(m_pCurFileWriter);
}
bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
{
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
std::wstring strEditorBin = NSSystemPath::Combine(strDirDst, L"Editor.bin");
NSDirectory::CreateDirectory(strDirSrc);
NSDirectory::CreateDirectory(strDirDst);
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
if(saveToFile(strEditorBin, strDirSrc, sXMLOptions))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName))
return true;
return false;
}
bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
{
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, L"Editor.bin");
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
NSDirectory::CreateDirectory(strDirSrc);
NSDirectory::CreateDirectory(strDirDst);
std::wstring sEditorBin = strEditorBin;
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
{
std::wstring sMediaPath;
std::wstring sThemePath;
std::wstring sEmbedPath;
CreateDocxFolders(strDirDst, sThemePath, sMediaPath, sEmbedPath);
if(loadFromFile(sEditorBin, strDirDst, sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
{
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, true))
return true;
}
}
return false;
}
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
{
OOX::CPath pathMain(sSrcFileName);
@ -144,13 +99,17 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
BinaryFileWriter oBinaryFileWriter(*m_pParamsWriter);
if (m_bIsNoBase64)
{
oBufferedStream.WriteStringUtf8(oBinaryFileWriter.WriteFileHeader(0, g_nFormatVersionNoBase64));
}
oBinaryFileWriter.intoBindoc(sDstPath);
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
int nBinBufferLen = oBufferedStream.GetPosition();
if (m_bIsNoBase64Save)
if (m_bIsNoBase64 || m_bIsNoBase64Save)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sSrcFileName);
@ -166,7 +125,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sSrcFileName);
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen));
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen, g_nFormatVersion));
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
oFile.CloseFile();
}
@ -268,27 +227,42 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
else
dst_len += _c;
}
int nDataSize = atoi(dst_len.c_str());
BYTE* pData = new BYTE[nDataSize];
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
int nVersion = g_nFormatVersion;
if(!version.empty())
{
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
oBufferedStream.Init(pData, 0, nDataSize);
version = version.substr(1);
g_nCurFormatVersion = nVersion = std::stoi(version.c_str());
}
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
int nVersion = g_nFormatVersion;
if(!version.empty())
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
int nDataSize = 0;
BYTE* pData = NULL;
if (!bIsNoBase64)
{
nDataSize = atoi(dst_len.c_str());
pData = new BYTE[nDataSize];
if(Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
{
version = version.substr(1);
int nTempVersion = atoi(version.c_str());
if(0 != nTempVersion)
{
g_nCurFormatVersion = nVersion = nTempVersion;
}
}
oBufferedStream.Init(pData, 0, nDataSize);
}
else
{
RELEASEARRAYOBJECTS(pData);
}
}
else
{
nDataSize = nBase64DataSize;
pData = pBase64Data;
oBufferedStream.Init(pData, 0, nDataSize);
oBufferedStream.Seek(nIndex);
}
if (NULL != pData)
{
oDrawingConverter.SetMainDocument(this);
oDrawingConverter.SetMediaDstPath(sMediaPath);
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
@ -318,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);
@ -343,6 +317,11 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
bResultOk = true;
}
if (!bIsNoBase64)
{
RELEASEARRAYOBJECTS(pData);
}
}
RELEASEARRAYOBJECTS(pBase64Data);
}
@ -472,6 +451,10 @@ void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool bIsNoBase64Save)
{
m_bIsNoBase64Save = bIsNoBase64Save;
}
void BinDocxRW::CDocxSerializer::setIsNoBase64(bool bIsNoBase64)
{
m_bIsNoBase64 = bIsNoBase64;
}
void BinDocxRW::CDocxSerializer::setSaveChartAsImg(bool bSaveChartAsImg)
{
m_bSaveChartAsImg = bSaveChartAsImg;

View File

@ -54,6 +54,7 @@ namespace BinDocxRW
std::wstring m_sFontDir;
std::wstring m_sEmbeddedFontsDir;
bool m_bIsNoBase64Save;
bool m_bIsNoBase64;
bool m_bSaveChartAsImg;
ParamsWriter* m_pParamsWriter;
Writers::FileWriter* m_pCurFileWriter;
@ -61,9 +62,6 @@ namespace BinDocxRW
CDocxSerializer();
virtual ~CDocxSerializer();
bool ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
bool ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath);
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
@ -78,6 +76,7 @@ namespace BinDocxRW
void setFontDir (const std::wstring& sFontDir);
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
void setIsNoBase64Save (bool bIsNoBase64Save);
void setIsNoBase64 (bool bIsNoBase64);
void setSaveChartAsImg (bool bSaveChartAsImg);
};
}

View File

@ -49,6 +49,7 @@ namespace BinXlsxRW{
CXlsxSerializer::CXlsxSerializer()
{
m_pExternalDrawingConverter = NULL;
m_bIsNoBase64 = false;
}
CXlsxSerializer::~CXlsxSerializer()
{
@ -134,7 +135,7 @@ namespace BinXlsxRW{
oOfficeDrawingConverter.SetFontPicker(pFontPicker);
BinXlsxRW::BinaryFileWriter oBinaryFileWriter(fp);
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions);
oBinaryFileWriter.Open(sSrcPath, sDstFileName, pEmbeddedFontsManager, &oOfficeDrawingConverter, sXMLOptions, m_bIsNoBase64);
RELEASEOBJECT(pFontPicker);
return true;
@ -226,6 +227,11 @@ namespace BinXlsxRW{
{
m_pExternalDrawingConverter = pDrawingConverter;
}
void CXlsxSerializer::setIsNoBase64(bool bIsNoBase64)
{
m_bIsNoBase64 = bIsNoBase64;
}
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
{
//анализируем chart

View File

@ -55,6 +55,7 @@ namespace BinXlsxRW {
std::wstring m_sFontDir;
std::wstring m_sEmbeddedFontsDir;
NSBinPptxRW::CDrawingConverter* m_pExternalDrawingConverter;
bool m_bIsNoBase64;
public:
CXlsxSerializer();
~CXlsxSerializer();
@ -69,6 +70,7 @@ namespace BinXlsxRW {
void setFontDir (const std::wstring& sFontDir);
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
void setIsNoBase64 (bool bIsNoBase64);
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
};

View File

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

View File

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

View File

@ -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) );
@ -189,6 +196,14 @@ namespace formulasconvert {
return c1 + (c3.empty() ? L"" : (L":" + c3) );
}
}
else if (sz == 5 && !what[1].matched)
{
const std::wstring c1 = what[2].str();
const std::wstring c2 = what[3].str(); //sheet name 2
const std::wstring c3 = what[4].str();
return c1 + (c3.empty() ? L"" : (L":" + c3) );
}
return L"";
}
std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what)
@ -216,10 +231,10 @@ namespace formulasconvert {
void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName)
{
convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/*
[ $ Sheet2 . A1 : . B5 ]
[ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
*/
const std::wstring res = boost::regex_replace(
@ -235,7 +250,7 @@ namespace formulasconvert {
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace(
expr,
complexRef,
@ -551,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);
@ -582,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)
@ -590,34 +617,44 @@ namespace formulasconvert {
bool isFormula = impl_->check_formula(workstr);
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
impl_->replace_cells_range(workstr, withTableName);
impl_->replace_semicolons(workstr);
impl_->replace_vertical(workstr);
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
if (isFormula)
{
//могут быть частично заданы диапазоны
//todooo
workstr = impl_->convert(expr);
}
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
if (!isFormula)
else
{
workstr = L"\"" + workstr + L"\"";
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
impl_->replace_cells_range(workstr, withTableName);
impl_->replace_semicolons(workstr);
impl_->replace_vertical(workstr);
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
{
//могут быть частично заданы диапазоны
//todooo
}
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;
}

View File

@ -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_;
}

View File

@ -212,6 +212,11 @@ SOURCES += \
../src/odf/datatypes/xlink.cpp \
../src/odf/datatypes/chartlabelposition.cpp \
../src/odf/datatypes/grandtotal.cpp \
../src/odf/datatypes/membertype.cpp \
../src/odf/datatypes/tabletype.cpp \
../src/odf/datatypes/tableorientation.cpp \
../src/odf/datatypes/tablefunction.cpp \
../src/odf/datatypes/tableorder.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -281,6 +286,7 @@ SOURCES += \
../src/docx/xlsx_table_metrics.cpp \
../src/docx/xlsx_table_state.cpp \
../src/docx/xlsx_textcontext.cpp \
../src/docx/xlsx_pivots_context.cpp \
../src/docx/xlsx_utils.cpp \
../src/docx/xlsx_xf.cpp
}

View File

@ -121,3 +121,8 @@
#include "../src/odf/datatypes/xlink.cpp"
#include "../src/odf/datatypes/chartlabelposition.cpp"
#include "../src/odf/datatypes/grandtotal.cpp"
#include "../src/odf/datatypes/membertype.cpp"
#include "../src/odf/datatypes/tabletype.cpp"
#include "../src/odf/datatypes/tableorientation.cpp"
#include "../src/odf/datatypes/tablefunction.cpp"
#include "../src/odf/datatypes/tableorder.cpp"

View File

@ -100,3 +100,4 @@
#include "../src/docx/xlsx_textcontext.cpp"
#include "../src/docx/xlsx_utils.cpp"
#include "../src/docx/xlsx_xf.cpp"
#include "../src/docx/xlsx_pivots_context.cpp"

View File

@ -57,8 +57,7 @@ public:
std::wstringstream ole_objects_;
std::wstringstream page_props_;
rels hyperlinks_rels_;
rels ole_objects_rels_;
rels sheet_rels_;
std::wstring drawingName_;
std::wstring drawingId_;
@ -141,14 +140,11 @@ std::wostream & xlsx_xml_worksheet::page_properties()
}
//---------------------------------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels()
rels & xlsx_xml_worksheet::sheet_rels()
{
return impl_->hyperlinks_rels_;
}
rels & xlsx_xml_worksheet::ole_objects_rels()
{
return impl_->ole_objects_rels_;
return impl_->sheet_rels_;
}
void xlsx_xml_worksheet::write_to(std::wostream & strm)
{
CP_XML_WRITER(strm)

View File

@ -49,8 +49,8 @@ class xlsx_xml_worksheet: noncopyable
public:
xlsx_xml_worksheet(std::wstring const & name);
~xlsx_xml_worksheet();
public:
std::wstring name() const;
std::wstring name() const;
std::wostream & cols();
std::wostream & sheetFormat();
@ -65,9 +65,8 @@ public:
std::wostream & ole_objects();
std::wostream & page_properties();
rels & hyperlinks_rels();
rels & ole_objects_rels();
rels & sheet_rels(); //hyperlink, background image, external, media ...
void write_to(std::wostream & strm);
void set_drawing_link (std::wstring const & fileName, std::wstring const & id);

View File

@ -32,8 +32,6 @@
#include "xlsx_package.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/ref.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
@ -76,14 +74,33 @@ 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);
content_type_file_.write(RootPath);
}
////////////////////////////////////////////
//--------------------------------------------------------------------------------------------
pivot_cache_content::pivot_cache_content() : definitions_rels_file_(rels_file::create(L""))
{
}
_CP_PTR(pivot_cache_content) pivot_cache_content::create()
{
return boost::make_shared<pivot_cache_content>();
}
//--------------------------------------------------------------------------------------------
pivot_table_content::pivot_table_content() : rels_file_(rels_file::create(L""))
{
}
_CP_PTR(pivot_table_content) pivot_table_content::create()
{
return boost::make_shared<pivot_table_content>();
}
//--------------------------------------------------------------------------------------------
sheet_content::sheet_content() : rels_(rels_file::create(L""))
{
@ -101,13 +118,13 @@ void sheet_content::add_rel(relationship const & r)
void sheet_content::add_rels(rels & r)
{
BOOST_FOREACH(relationship & item, r.relationships())
std::vector<relationship> & items = r.relationships();
for (size_t i = 0; i < items.size(); i++)
{
rels_->get_rels().add(item);
rels_->get_rels().add(items[i]);
}
}
////////////
//--------------------------------------------------------------------------------------------
sheets_files::sheets_files()
{}
@ -121,41 +138,36 @@ void sheets_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"worksheets";
NSDirectory::CreateDirectory(path.c_str());
size_t count = 0;
BOOST_FOREACH(const sheet_content_ptr & item, sheets_)
for (size_t i = 0; i < sheets_.size(); i++)
{
if (item)
sheet_content_ptr & item = sheets_[i];
if (!item) continue;
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
if (rels_)
{
count++;
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
if (rels_)
{
const std::wstring id = std::wstring(L"sId") + std::to_wstring(count);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef);
}
item->get_rel_file()->set_file_name(fileName + L".rels");
rels_files relFiles;
relFiles.add_rel_file(item->get_rel_file());
relFiles.write(path);
//item->get_rel_file()->write(path.string<std::wstring>());
package::simple_element(fileName, item->str()).write(path);
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef);
}
item->get_rel_file()->set_file_name(fileName + L".rels");
rels_files relFiles;
relFiles.add_rel_file(item->get_rel_file());
relFiles.write(path);
//item->get_rel_file()->write(path.string<std::wstring>());
package::simple_element(fileName, item->str()).write(path);
}
}
////////////////////////////////////////////
//--------------------------------------------------------------------------------------------
xl_files::xl_files()
{
rels_files_.add_rel_file(rels_file::create(L"workbook.xml.rels"));
@ -166,10 +178,20 @@ void xl_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(path.c_str());
sheets_files_.set_rels(&rels_files_);
sheets_files_.set_main_document( this->get_main_document() );
sheets_files_.write(path);
{
pivot_cache_files_.set_rels(&rels_files_);
pivot_cache_files_.set_main_document(get_main_document());
pivot_cache_files_.write(path);
}
{
pivot_table_files_.set_main_document(get_main_document());
pivot_table_files_.write(path);
}
{
sheets_files_.set_rels(&rels_files_);
sheets_files_.set_main_document( this->get_main_document() );
sheets_files_.write(path);
}
int index = 1;
if (true)
{
@ -181,7 +203,16 @@ void xl_files::write(const std::wstring & RootPath)
sharedStrings_->write(path);
rels_files_.add( relationship( L"shId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", L"sharedStrings.xml" ) );
}
if (styles_)
if (connections_)
{
connections_->write(path);
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
contentTypes->add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
}
if (styles_)
{
styles_->write(path);
rels_files_.add( relationship( L"stId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", L"styles.xml" ) );
@ -235,7 +266,10 @@ void xl_files::set_sharedStrings(element_ptr Element)
{
sharedStrings_ = Element;
}
void xl_files::set_connections(element_ptr Element)
{
connections_ = Element;
}
void xl_files::add_sheet(sheet_content_ptr sheet)
{
sheets_files_.add_sheet(sheet);
@ -269,7 +303,102 @@ void xl_files::add_charts(chart_content_ptr chart)
{
charts_files_.add_chart(chart);
}
////////////////////////////
void xl_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
{
pivot_cache_files_.add_pivot_cache(pivot_cache);
}
void xl_files::add_pivot_table(pivot_table_content_ptr pivot_table)
{
pivot_table_files_.add_pivot_table(pivot_table);
}
//----------------------------------------------------------------------------------------
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
{
pivot_caches_.push_back(pivot_cache);
}
void xl_pivot_cache_files::write(const std::wstring & RootPath)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotCache";
NSDirectory::CreateDirectory(path.c_str());
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConTypeD = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
static const std::wstring kWSConTypeR = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
for (size_t i = 0; i < pivot_caches_.size(); i++)
{
if (pivot_caches_[i])
{
const std::wstring fileNameD = std::wstring(L"pivotCacheDefinition") + std::to_wstring(i + 1) + L".xml";
contentTypes->add_override(std::wstring(L"/xl/pivotCache/") + fileNameD, kWSConTypeD);
package::simple_element(fileNameD, pivot_caches_[i]->str_d()).write(path);
if (pivot_caches_[i]->get_rels().empty() == false)
{
rels_files relFiles;
pivot_caches_[i]->definitions_rels_file_->set_file_name(fileNameD + L".rels");
relFiles.add_rel_file(pivot_caches_[i]->definitions_rels_file_);
relFiles.write(path);
}
if (rels_) //for workbook
{
const std::wstring id = std::wstring(L"pcId") + std::to_wstring(i + 1);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
const std::wstring fileRef = std::wstring(L"pivotCache/") + fileNameD;
rels_->add(id, kWSRel, fileRef);
}
std::wstring content_records = pivot_caches_[i]->str_r();
if (!content_records.empty())
{
const std::wstring fileNameR = std::wstring(L"pivotCacheRecords") + std::to_wstring(i + 1) + L".xml";
contentTypes->add_override(std::wstring(L"/xl/pivotCache/") + fileNameR, kWSConTypeR);
package::simple_element(fileNameR, content_records).write(path);
}
}
}
}
//----------------------------------------------------------------------------------------
void xl_pivot_table_files::add_pivot_table(pivot_table_content_ptr pivot_table)
{
pivot_tables_.push_back(pivot_table);
}
void xl_pivot_table_files::write(const std::wstring & RootPath)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotTables";
NSDirectory::CreateDirectory(path.c_str());
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
for (size_t i = 0; i < pivot_tables_.size(); i++)
{
if (pivot_tables_[i])
{
const std::wstring fileName = std::wstring(L"pivotTable") + std::to_wstring(i + 1) + L".xml";
contentTypes->add_override(std::wstring(L"/xl/pivotTables/") + fileName, kWSConType);
package::simple_element(fileName, pivot_tables_[i]->str()).write(path);
if (pivot_tables_[i]->get_rels().empty() == false)
{
rels_files relFiles;
pivot_tables_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(pivot_tables_[i]->rels_file_);
relFiles.write(path);
}
}
}
}
//------------------------------------------------------------------------------------------------------
void xl_charts_files::add_chart(chart_content_ptr chart)
{
charts_.push_back(chart);
@ -281,29 +410,26 @@ void xl_charts_files::write(const std::wstring & RootPath)
size_t count = 0;
BOOST_FOREACH(const chart_content_ptr & item, charts_)
for (size_t i = 0; i < charts_.size(); i++)
{
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes->add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
count++;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes->add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(path);
rels_files relFiles;
package::simple_element(fileName, charts_[i]->str()).write(path);
rels_files relFiles;
item->get_rel_file()->set_file_name(fileName + L".rels");
relFiles.add_rel_file(item->get_rel_file());
relFiles.write(path);
}
charts_[i]->get_rel_file()->set_file_name(fileName + L".rels");
relFiles.add_rel_file(charts_[i]->get_rel_file());
relFiles.write(path);
}
}
//////////////////////////
//------------------------------------------------------------------------------------------------------
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
{
return boost::make_shared<xl_drawings>(boost::ref(elms));
@ -314,14 +440,14 @@ void xl_drawings::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
NSDirectory::CreateDirectory(path.c_str());
BOOST_FOREACH(drawing_elm const & e, drawings_)
for (size_t i = 0; i < drawings_.size(); i++)
{
package::simple_element(e.filename, e.content).write(path);
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
rels_files relFiles;
rels_file_ptr r = rels_file::create(e.filename + L".rels");
rels_file_ptr r = rels_file::create(drawings_[i].filename + L".rels");
e.drawings->dump_rels_drawing(r->get_rels());
drawings_[i].drawings->dump_rels_drawing(r->get_rels());
relFiles.add_rel_file(r);
relFiles.write(path);
@ -329,7 +455,7 @@ void xl_drawings::write(const std::wstring & RootPath)
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
contentTypes->add_override(L"/xl/drawings/" + e.filename, kDrawingCT);
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
}
}
@ -344,15 +470,15 @@ void xl_comments::write(const std::wstring & RootPath)
std::wstring vml_path = RootPath + FILE_SEPARATOR_STR + L"drawings";
NSDirectory::CreateDirectory(vml_path.c_str());
BOOST_FOREACH(comment_elm const & e, comments_)
for (size_t i = 0; i < comments_.size(); i++)
{
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
contentTypes->add_override(std::wstring(L"/xl/") + e.filename, kWSConType);
contentTypes->add_override(std::wstring(L"/xl/") + comments_[i].filename, kWSConType);
package::simple_element(e.filename, e.content).write(RootPath);
package::simple_element(e.vml_filename, e.vml_content).write(vml_path);
package::simple_element(comments_[i].filename, comments_[i].content).write(RootPath);
package::simple_element(comments_[i].vml_filename, comments_[i].vml_content).write(vml_path);
}
}

View File

@ -50,9 +50,6 @@ public:
xlsx_content_types_file();
};
class sheet_content;
typedef _CP_PTR(sheet_content) sheet_content_ptr;
class sheet_content : noncopyable
{
public:
@ -68,8 +65,49 @@ private:
std::wstringstream content_;
rels_file_ptr rels_;
};
typedef _CP_PTR(sheet_content) sheet_content_ptr;
//------------------------------------------------------------------------
class pivot_cache_content;
typedef _CP_PTR(pivot_cache_content) pivot_cache_content_ptr;
class pivot_cache_content : boost::noncopyable
{
public:
pivot_cache_content();
static _CP_PTR(pivot_cache_content) create();
// sheets_files
std::wostream & definitions() { return definitions_; }
std::wostream & records() { return records_; }
rels & get_rels() { return definitions_rels_file_->get_rels(); }
std::wstring str_d() { return definitions_.str(); }
std::wstring str_r() { return records_.str(); }
friend class xl_pivot_cache_files;
private:
std::wstringstream records_;
std::wstringstream definitions_;
rels_file_ptr definitions_rels_file_;
};
//------------------------------------------------------------------------
class pivot_table_content;
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
class pivot_table_content : boost::noncopyable
{
public:
pivot_table_content();
static _CP_PTR(pivot_table_content) create();
std::wostream & content() { return content_; }
rels & get_rels() { return rels_file_->get_rels(); }
std::wstring str() { return content_.str(); }
friend class xl_pivot_table_files;
private:
std::wstringstream content_;
rels_file_ptr rels_file_;
};
//------------------------------------------------------------------------
class sheets_files : public element
{
public:
@ -90,7 +128,7 @@ public:
};
// xl_charts_files
class xl_charts_files : public element
{
public:
@ -102,12 +140,37 @@ public:
std::vector<chart_content_ptr> charts_;
};
///////////////////////////////////////////////////////////
class xl_pivot_table_files : public element
{
public:
xl_pivot_table_files(){}
void add_pivot_table(pivot_table_content_ptr pivot_table);
virtual void write(const std::wstring & RootPath);
std::vector<pivot_table_content_ptr> pivot_tables_;
};
class xl_pivot_cache_files : public element
{
public:
xl_pivot_cache_files(){}
void set_rels(rels_files * rels)
{
rels_ = rels;
}
void add_pivot_cache(pivot_cache_content_ptr pivot_cache);
virtual void write(const std::wstring & RootPath);
std::vector<pivot_cache_content_ptr> pivot_caches_;
rels_files * rels_;
};
//-------------------------------------------------------------------------------------------------------------
class xl_comments;
typedef _CP_PTR(xl_comments) xl_comments_ptr;
// xl_comments
class xl_comments: public element
{
public:
@ -121,13 +184,10 @@ public:
private:
const std::vector<comment_elm> & comments_;
};
//-----------------------------------------------------------------------------------------------------
class xl_drawings;
typedef _CP_PTR(xl_drawings) xl_drawings_ptr;
// xl_drawings
class xl_drawings: public element
{
public:
@ -146,10 +206,9 @@ public:
private:
const std::vector<drawing_elm> & drawings_;
rels_files * rels_;
};
//----------------------------------------------------------------------------------------------------------
// xl_files
class xl_files : public element
{
public:
@ -158,20 +217,25 @@ public:
public:
virtual void write(const std::wstring & RootPath);
void set_workbook(element_ptr Element);
void set_styles(element_ptr Element);
void set_sharedStrings(element_ptr Element);
void add_sheet(sheet_content_ptr sheet);
void set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void set_drawings(element_ptr Element);
void set_vml_drawings(element_ptr Element);
void set_comments(element_ptr Element);
void add_charts(chart_content_ptr chart);
void set_workbook (element_ptr Element);
void set_styles (element_ptr Element);
void set_sharedStrings (element_ptr Element);
void set_connections (element_ptr Element);
void add_sheet (sheet_content_ptr sheet);
void set_media (mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void set_drawings (element_ptr Element);
void set_vml_drawings (element_ptr Element);
void set_comments (element_ptr Element);
void add_charts (chart_content_ptr chart);
void add_pivot_cache (pivot_cache_content_ptr cache);
void add_pivot_table (pivot_table_content_ptr table);
private:
rels_files rels_files_;
sheets_files sheets_files_;
xl_charts_files charts_files_;
rels_files rels_files_;
sheets_files sheets_files_;
xl_charts_files charts_files_;
xl_pivot_cache_files pivot_cache_files_;
xl_pivot_table_files pivot_table_files_;
element_ptr theme_;
element_ptr workbook_;
@ -183,10 +247,9 @@ private:
element_ptr drawings_;
element_ptr vml_drawings_;
element_ptr comments_;
element_ptr connections_;
};
// xlsx_document
class xlsx_document : public document
{
public:

View File

@ -0,0 +1,455 @@
/*
* (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
*
*/
#include "xlsx_pivots_context.h"
#include <boost/make_shared.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace oox {
class xlsx_pivots_context::Impl
{
public:
struct _pivot_xml
{
std::wstring definitionsData_; //cacheData
std::wstring recordsData_; //cacheRecorda
std::wstring viewData_; //tableView
};
Impl() {}
std::vector<_pivot_xml> pivot_xmls_;
std::wstring connections_;
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::Impl::serialize_view(std::wostream & 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", 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);
//CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
//CP_XML_ATTR(L"applyPatternFormats", view->fAtrPat);
//CP_XML_ATTR(L"applyAlignmentFormats", view->fAtrAlc);
//CP_XML_ATTR(L"applyWidthHeightFormats", view->fAtrProc);
//if (!view->stData.value().empty())
//{
// CP_XML_ATTR(L"dataCaption", view->stData.value());
//}
//CP_XML_ATTR(L"asteriskTotals", 1);
//CP_XML_ATTR(L"showMemberPropertyTips", 0);
//CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
//CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"itemPrintTitles", 1);
CP_XML_ATTR(L"indent", 0);
CP_XML_ATTR(L"compact", 0);
CP_XML_ATTR(L"compactData", 0);
CP_XML_ATTR(L"gridDropZones", 1);
CP_XML_NODE(L"location")
{
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);
CP_XML_ATTR(L"rowPageCount", 1);
CP_XML_ATTR(L"colPageCount", 1);
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", current_.fields.size());
for (size_t i = 0; i < current_.fields.size(); i++)
{
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"");
}
}
}
}
}
}
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()
{
}
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)
{
if (connections.empty()) return;
impl_->connections_ = connections;
}
xlsx_pivots_context::~xlsx_pivots_context()
{
}
}
}

View File

@ -0,0 +1,87 @@
/*
* (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
#include "oox_package.h"
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore {
namespace oox {
class xlsx_pivot_cache_context;
typedef _CP_PTR(xlsx_pivot_cache_context) xlsx_pivot_cache_context_ptr;
class xlsx_pivots_context
{
public:
xlsx_pivots_context();
~xlsx_pivots_context();
void start_table();
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 get_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);
void write_connections_to (std::wostream & strm);
void write_table_view_to (int index, std::wostream & strm);
void dump_rels_cache(int index, rels & Rels);
void dump_rels_view (int index, rels & Rels);
void add_connections(std::wstring connections);
bool is_connections();
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -152,8 +152,7 @@ void xlsx_conversion_context::end_document()
content->add_rel(relationship(dId, kType, dName));
}
//////////////////////////////////////////////////////////////////////////////////////////////////
content->add_rels(sheet->hyperlinks_rels());
content->add_rels(sheet->ole_objects_rels());
content->add_rels(sheet->sheet_rels());
/////////////////////////////////////////////////////////////////////////////////////////////////
const std::pair<std::wstring, std::wstring> p2 = sheet->get_comments_link();
if (!p2.first.empty())
@ -232,6 +231,54 @@ void xlsx_conversion_context::end_document()
}
get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
int pivot_cache_count = xlsx_pivots_context_.get_count();
if (pivot_cache_count > 0)
{
CP_XML_NODE(L"pivotCaches")
{
for (int i = 0; i < pivot_cache_count; i++)
{
std::wstring rId = L"pcId" + std::to_wstring(i+1);
static const std::wstring sType = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
const std::wstring sName = std::wstring(L"../pivotCache/pivotCacheDefinition" + std::to_wstring(i + 1) + L".xml");
package::pivot_cache_content_ptr content = package::pivot_cache_content::create();
CP_XML_NODE(L"pivotCache")
{
CP_XML_ATTR(L"cacheId", std::to_wstring(i));
CP_XML_ATTR(L"r:id", rId);
}
xlsx_pivots_context_.dump_rels_cache(i, content->get_rels());
xlsx_pivots_context_.write_cache_definitions_to(i, content->definitions());
xlsx_pivots_context_.write_cache_records_to(i, content->records());
output_document_->get_xl_files().add_pivot_cache(content);
}
}
}
int pivot_view_count = xlsx_pivots_context_.get_count();
if (pivot_view_count > 0)
{
for (int i = 0; i < pivot_view_count; i++)
{
package::pivot_table_content_ptr content = package::pivot_table_content::create();
xlsx_pivots_context_.dump_rels_view(i, content->get_rels());
xlsx_pivots_context_.write_table_view_to(i, content->content());
output_document_->get_xl_files().add_pivot_table(content);
}
}
if (xlsx_pivots_context_.is_connections())
{
std::wstringstream strm;
xlsx_pivots_context_.write_connections_to(strm);
output_document_->get_xl_files().set_connections( package::simple_element::create(L"connections.xml", strm.str()) );
}
}
}
@ -316,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));
@ -381,9 +444,8 @@ void xlsx_conversion_context::end_table()
get_table_context().serialize_hyperlinks (current_sheet().hyperlinks());
get_table_context().serialize_ole_objects (current_sheet().ole_objects());
get_table_context().dump_rels_hyperlinks (current_sheet().hyperlinks_rels());
get_table_context().dump_rels_ole_objects (current_sheet().ole_objects_rels());
get_table_context().dump_rels_hyperlinks (current_sheet().sheet_rels());
get_table_context().dump_rels_ole_objects (current_sheet().sheet_rels());
if (!get_drawing_context().empty())
{

View File

@ -48,6 +48,7 @@
#include "xlsx_comments_context.h"
#include "xlsx_defined_names.h"
#include "xlsx_table_metrics.h"
#include "xlsx_pivots_context.h"
#include "oox_chart_context.h"
#include "mediaitems.h"
@ -101,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 ();
@ -161,13 +165,13 @@ 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_; }
num_format_context & get_num_format_context() { return num_format_context_; }
size_t get_default_cell_style() const { return default_style_; }
xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; }
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
xlsx_table_metrics & get_table_metrics();
xlsx_drawing_context & get_drawing_context();
xlsx_drawing_context_handle & get_drawing_context_handle();
@ -202,6 +206,7 @@ private:
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;
math_context math_context_;
xlsx_pivots_context xlsx_pivots_context_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
xlsx_comments_context_handle xlsx_comments_context_handle_;
};

View File

@ -837,7 +837,7 @@ void process_build_object::visit(table_table_rows& val)
}
void process_build_object::visit(const table_table_row & val)
{
unsigned int repeated = val.table_table_row_attlist_.table_number_rows_repeated_;
unsigned int repeated = val.attlist_.table_number_rows_repeated_;
ACCEPT_ALL_CONTENT_CONST(val.content_);
visit_rows(repeated);
}
@ -891,13 +891,13 @@ void process_build_object::visit(const table_rows_no_group& val)
}
void process_build_object::visit(const table_table_cell& val)
{
const table_table_cell_attlist & attlist = val.table_table_cell_attlist_;
const table_table_cell_attlist & attlist = val.attlist_;
unsigned int repeated = val.table_table_cell_attlist_.table_number_columns_repeated_;
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
std::wstringstream wstream_temp;
val.table_table_cell_content_.text_to_stream(wstream_temp);
val.content_.text_to_stream(wstream_temp);
std::wstring cell_cash = wstream_temp.str();
std::wstring cell_val;
@ -920,7 +920,7 @@ void process_build_object::visit(const table_table_cell& val)
}
void process_build_object::visit(const table_covered_table_cell& val)
{
unsigned int repeated = val.table_table_cell_attlist_.table_number_columns_repeated_;
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
if ( repeated <2)
return;

View File

@ -0,0 +1,74 @@
/*
* (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
*
*/
#include "membertype.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const member_type & _Val)
{
switch(_Val.get_type())
{
case member_type::named:
_Wostream << L"named";
break;
case member_type::next:
_Wostream << L"next";
break;
case member_type::previous:
_Wostream << L"previous";
break;
}
return _Wostream;
}
member_type member_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"named")
return member_type( named );
else if (tmp == L"next")
return member_type( next );
else if (tmp == L"previous")
return member_type( previous );
else
{
return member_type( named );
}
}
} }

View File

@ -0,0 +1,73 @@
/*
* (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
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class member_type
{
public:
enum type
{
named,
next,
previous
};
member_type() {}
member_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static member_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const member_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::member_type);
}

View File

@ -74,7 +74,6 @@ table_align table_align::parse(const std::wstring & Str)
return table_align( Margins );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return table_align( Left );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_TABLEALIGN_H_
#define _CPDOCCORE_ODF_TABLEALIGN_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -78,5 +74,3 @@ std::wostream & operator << (std::wostream & _Wostream, const table_align & _Val
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_align);
}
#endif

View File

@ -0,0 +1,121 @@
/*
* (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
*
*/
#include "tablefunction.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_function & _Val)
{
switch(_Val.get_type())
{
case table_function::Auto:
_Wostream << L"auto";
break;
case table_function::average:
_Wostream << L"average";
break;
case table_function::count:
_Wostream << L"count";
break;
case table_function::countnums:
_Wostream << L"countnums";
break;
case table_function::max:
_Wostream << L"max";
break;
case table_function::min:
_Wostream << L"min";
break;
case table_function::product:
_Wostream << L"product";
break;
case table_function::stdev:
_Wostream << L"stdev";
break;
case table_function::stdevp:
_Wostream << L"stdevp";
break;
case table_function::sum:
_Wostream << L"sum";
break;
case table_function::var:
_Wostream << L"var";
break;
case table_function::varp:
_Wostream << L"varp";
break;
default:
_Wostream << _Val.get_string();
break;
}
return _Wostream;
}
table_function table_function::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"auto")
return table_function( Auto );
else if (tmp == L"average")
return table_function( average );
else if (tmp == L"count")
return table_function( count );
else if (tmp == L"countnums")
return table_function( countnums );
else if (tmp == L"max")
return table_function( max );
else if (tmp == L"min")
return table_function( min );
else if (tmp == L"product")
return table_function( product );
else if (tmp == L"stdev")
return table_function( stdev );
else if (tmp == L"stdevp")
return table_function( stdevp );
else if (tmp == L"sum")
return table_function( sum );
else if (tmp == L"var")
return table_function( var );
else if (tmp == L"varp")
return table_function( varp );
else
{
return table_function( String, Str );
}
}
}
}

View File

@ -0,0 +1,88 @@
/*
* (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
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_function
{
public:
enum type
{
Auto,
average,
count,
countnums,
max,
min,
product,
stdev,
stdevp,
sum,
var,
varp,
String
};
table_function() {}
table_function(type _Type, std::wstring _string = L"") : type_(_Type), string_(_string)
{}
type get_type() const
{
return type_;
};
std::wstring get_string() const
{
return string_;
};
static table_function parse(const std::wstring & Str);
private:
type type_;
std::wstring string_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_function & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_function);
}

View File

@ -0,0 +1,72 @@
/*
* (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
*
*/
#include "tableorder.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_order & _Val)
{
switch(_Val.get_type())
{
case table_order::ascending:
_Wostream << L"ascending";
break;
case table_order::descending:
_Wostream << L"descending";
break;
default:
_Wostream << L"ascending";
break;
}
return _Wostream;
}
table_order table_order::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"ascending")
return table_order( ascending);
else if (tmp == L"descending")
return table_order( descending );
else
{
return table_order( ascending );
}
}
} }

View File

@ -0,0 +1,73 @@
/*
* (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
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_order
{
public:
enum type
{
ascending,
descending
};
table_order() {}
table_order(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_order parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_order & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_order);
}

View File

@ -0,0 +1,82 @@
/*
* (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
*
*/
#include "tableorientation.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_orientation & _Val)
{
switch(_Val.get_type())
{
case table_orientation::column:
_Wostream << L"column";
break;
case table_orientation::data:
_Wostream << L"data";
break;
case table_orientation::hidden:
_Wostream << L"hidden";
break;
case table_orientation::page:
_Wostream << L"page";
break;
default:
_Wostream << L"row";
break;
}
return _Wostream;
}
table_orientation table_orientation::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"column")
return table_orientation( column );
else if (tmp == L"data")
return table_orientation( data );
else if (tmp == L"hidden")
return table_orientation( hidden );
else if (tmp == L"page")
return table_orientation( page );
else
{
return table_orientation( row );
}
}
} }

View File

@ -0,0 +1,76 @@
/*
* (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
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_orientation
{
public:
enum type
{
column,
data,
hidden,
page,
row
};
table_orientation() {}
table_orientation(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_orientation parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_orientation & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_orientation);
}

View File

@ -0,0 +1,102 @@
/*
* (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
*
*/
#include "tabletype.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_type & _Val)
{
switch(_Val.get_type())
{
case table_type::none:
_Wostream << L"none";
break;
case table_type::member_difference:
_Wostream << L"member-difference";
break;
case table_type::member_percentage:
_Wostream << L"member-percentage";
break;
case table_type::member_percentage_difference:
_Wostream << L"member-percentage-difference";
break;
case table_type::running_total:
_Wostream << L"running-total";
break;
case table_type::row_percentage:
_Wostream << L"row-percentage";
break;
case table_type::column_percentage:
_Wostream << L"column-percentage";
break;
case table_type::total_percentage:
_Wostream << L"total-percentage";
break;
default:
_Wostream << L"index";
break;
}
return _Wostream;
}
table_type table_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"none")
return table_type( none );
else if (tmp == L"member-difference")
return table_type( member_difference );
else if (tmp == L"member-percentage")
return table_type( member_percentage );
else if (tmp == L"member-percentage-difference")
return table_type( member_percentage_difference );
else if (tmp == L"running-total")
return table_type( running_total );
else if (tmp == L"row-percentage")
return table_type( row_percentage );
else if (tmp == L"column-percentage")
return table_type( column_percentage );
else if (tmp == L"total-percentage")
return table_type( total_percentage );
else
{
return table_type( index );
}
}
} }

View File

@ -0,0 +1,80 @@
/*
* (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
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_type
{
public:
enum type
{
none,
member_difference,
member_percentage,
member_percentage_difference,
running_total,
row_percentage,
column_percentage,
total_percentage,
index
};
table_type() {}
table_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_type);
}

View File

@ -206,6 +206,12 @@ enum ElementType
typeTableSort,
typeTableSortBy,
typeTableFilter,
typeTableFilterAnd,
typeTableFilterOr,
typeTableFilterCondition,
typeTableFilterSetItem,
typeTableTable,
typeTableTableColumn,
typeTableTableColumns,
@ -223,11 +229,23 @@ enum ElementType
typeTableDataPilotTables,
typeTableDataPilotTable,
typeTableDataPilotField,
typeTableDataPilotFieldReference,
typeTableDatabaseSourceTable,
typeTableDatabaseSourceQuery,
typeTableDatabaseSourceSql,
typeTableSourceCellRange,
typeTableSourceService,
typeTableDataPilotSubtotals,
typeTableDataPilotSubtotal,
typeTableDataPilotGroupMember,
typeTableDataPilotMember,
typeTableDataPilotMembers,
typeTableDataPilotGroup,
typeTableDataPilotGroups,
typeTableDataPilotLevel,
typeTableDataSortInfo,
typeTableDataDisplayInfo,
typeTableDataLayoutInfo,
typeOfficeBody,
typeOfficeText,

View File

@ -48,26 +48,25 @@ const wchar_t * office_spreadsheet::name = L"spreadsheet";
void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"table", L"database-ranges")
{
CP_CREATE_ELEMENT(database_ranges_);
}
else if CP_CHECK_NAME(L"table", L"named-expressions")
{
CP_CREATE_ELEMENT(table_database_ranges_);
CP_CREATE_ELEMENT(named_expressions_);
}
else if CP_CHECK_NAME(L"table", L"data-pilot-tables")
{
CP_CREATE_ELEMENT(table_data_pilot_tables_);
CP_CREATE_ELEMENT(data_pilot_tables_);
}
else if CP_CHECK_NAME(L"table", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else
CP_CREATE_ELEMENT(content_);
}
void office_spreadsheet::add_text(const std::wstring & Text)
{
// TODO : error
}
void office_spreadsheet::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void office_spreadsheet::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
@ -81,21 +80,23 @@ void office_spreadsheet::docx_convert(oox::docx_conversion_context & Context)
void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process spreadsheet (" << content_.size() << L" elmements)" << std::endl;
_CP_LOG << L"[info][xlsx] process spreadsheet (" << content_.size() << L" tables)" << std::endl;
for (size_t i = 0; i < table_database_ranges_.size(); i++)
{
table_database_ranges_[i]->xlsx_convert(Context);
}
if (named_expressions_)
named_expressions_->xlsx_convert(Context);
if (database_ranges_)
database_ranges_->xlsx_convert(Context);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
for (size_t i = 0; i < table_data_pilot_tables_.size(); i++)
{
table_data_pilot_tables_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
if (data_pilot_tables_)
data_pilot_tables_->xlsx_convert(Context);
Context.end_office_spreadsheet();
}
}

View File

@ -41,7 +41,6 @@
namespace cpdoccore {
namespace odf_reader {
// office:spreadsheet
class office_spreadsheet : public office_element_impl<office_spreadsheet>
{
public:
@ -55,27 +54,29 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
virtual void add_text(const std::wstring & Text);
public:
// TODO: office-text-content-prelude:
// TODO: office-forms
// TODO: text-decls
// TODO: table-decls
office_element_ptr named_expressions_;
office_element_ptr database_ranges_;
office_element_ptr data_pilot_tables_;
office_element_ptr tracked_changes_;
office_element_ptr_array table_database_ranges_;
office_element_ptr_array table_data_pilot_tables_;
office_element_ptr tracked_changes_;//??
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions
// table:calculation-settings
// table:consolidation
// table:content-validations
// table:dde-links
// table:label-ranges
// text:alphabetical-index-auto-mark-file
// text:ddeconnection-decls
// text:sequence-decls
// text:user-fielddecls
// text:variable-decls
};
CP_REGISTER_OFFICE_ELEMENT2(office_spreadsheet);
}

View File

@ -201,8 +201,8 @@ public:
virtual void visit(const table_table_row& val)
{
unsigned int repeated = val.table_table_row_attlist_.table_number_rows_repeated_;
std::wstring defaultCellStyle = val.table_table_row_attlist_.table_default_cell_style_name_.get_value_or(L"");
unsigned int repeated = val.attlist_.table_number_rows_repeated_;
std::wstring defaultCellStyle = val.attlist_.table_default_cell_style_name_.get_value_or(L"");
if (visit_rows(repeated, defaultCellStyle))
{
@ -212,7 +212,7 @@ public:
virtual void visit(const table_table_cell& val)
{
unsigned int repeated = val.table_table_cell_attlist_.table_number_columns_repeated_;
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
std::wstring defaultColumnStyle, defaultRowStyle;
if (visit_cells(repeated, defaultColumnStyle, defaultRowStyle))
{
@ -224,7 +224,7 @@ public:
virtual void visit(const table_covered_table_cell& val)
{
unsigned int repeated = val.table_table_cell_attlist_.table_number_columns_repeated_;
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
std::wstring defaultColumnStyle, defaultRowStyle;
if ( repeated <2)

View File

@ -172,7 +172,7 @@ void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns,
CP_CREATE_ELEMENT(table_shapes_);
}
else if ( CP_CHECK_NAME(L"table", L"named-expressions") ||
CP_CHECK_NAME(L"table", L"named-range") )
CP_CHECK_NAME(L"table", L"named-range") ) //???
{
CP_CREATE_ELEMENT(table_named_);
}
@ -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
@ -376,49 +375,60 @@ const wchar_t * table_table_cell::name = L"table-cell";
std::wostream & table_table_cell::text_to_stream(std::wostream & _Wostream) const
{
return table_table_cell_content_.text_to_stream(_Wostream);
return content_.text_to_stream(_Wostream);
}
void table_table_cell::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
table_table_cell_attlist_.add_attributes(Attributes);
table_table_cell_attlist_extra_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
attlist_extra_.add_attributes(Attributes);
}
void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
table_table_cell_content_.add_child_element(Reader, Ns, Name, getContext());
content_.add_child_element(Reader, Ns, Name, getContext());
}
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";
std::wostream & table_covered_table_cell::text_to_stream(std::wostream & _Wostream) const
{
return table_table_cell_content_.text_to_stream(_Wostream);
return content_.text_to_stream(_Wostream);
}
void table_covered_table_cell::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
table_table_cell_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void table_covered_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
empty_ = false;
table_table_cell_content_.add_child_element(Reader, Ns, Name, getContext());
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
@ -432,7 +442,7 @@ std::wostream & table_table_row::text_to_stream(std::wostream & _Wostream) const
void table_table_row::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
table_table_row_attlist_.add_attributes( Attributes );
attlist_.add_attributes( Attributes );
}
void table_table_row::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -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";
@ -519,6 +560,42 @@ void table_rows::add_child_element( xml::sax * Reader, const std::wstring & Ns,
not_applicable_element(L"table-rows", Reader, Ns, Name);
}
}
void table_rows::remove_equals_empty()
{
if (table_table_row_.empty()) return;
while(true)
{
size_t i = table_table_row_.size() - 1;
if (i == 0) break;
if (table_table_row_[i]->get_type() != typeTableTableRow)
break;
if (table_table_row_[i-1]->get_type() != typeTableTableRow)
break;
table_table_row *prev = dynamic_cast<table_table_row*>(table_table_row_[i-1].get());
table_table_row *next = dynamic_cast<table_table_row*>(table_table_row_[i].get());
if (prev->content_.size() > 1 || next->content_.size() > 1) break;
if (prev->attlist_.table_style_name_.get_value_or(L"") != next->attlist_.table_style_name_.get_value_or(L"")) break;
table_table_cell *prev_cell = dynamic_cast<table_table_cell*>(prev->content_[0].get());
table_table_cell *next_cell = dynamic_cast<table_table_cell*>(next->content_[0].get());
if (!prev_cell || !next_cell) break;
if (!prev_cell->content_.elements_.empty() || !next_cell->content_.elements_.empty()) break;
if (prev_cell->attlist_.table_style_name_.get_value_or(L"") != next_cell->attlist_.table_style_name_.get_value_or(L"")) break;
prev->attlist_.table_number_rows_repeated_ += next->attlist_.table_number_rows_repeated_;
table_table_row_.pop_back();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:rows-no-group
@ -561,7 +638,6 @@ void table_rows_no_group::add_child_element( xml::sax * Reader, const std::wstri
else
not_applicable_element(L"table-rows-no-group", Reader, Ns, Name);
}
// table-rows-and-groups
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -51,13 +51,11 @@
namespace cpdoccore {
namespace odf_reader {
// table:table-attlist
class table_table_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(bool) table_is_sub_table_;
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_style_name_;
@ -76,13 +74,11 @@ public:
friend class table_table;
};
// table:table-row-attlist
class table_table_row_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
unsigned int table_number_rows_repeated_; // default 1
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(std::wstring) table_default_cell_style_name_;
@ -90,13 +86,11 @@ public:
};
// table:table-cell-attlist
class table_table_cell_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(std::wstring) table_content_validation_name_;
@ -104,18 +98,15 @@ public:
odf_types::common_value_and_type_attlist common_value_and_type_attlist_;
bool table_protect_; // default false
};
// table:table-cell-attlist-extra
class table_table_cell_attlist_extra
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
unsigned int table_number_columns_spanned_; // default 1
unsigned int table_number_rows_spanned_; // default 1
@ -124,25 +115,21 @@ public:
};
// table-table-source-attlist
class table_table_source_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
odf_types::table_mode table_mode_; // default CopyAll
_CP_OPT(std::wstring) table_table_name_;
};
// table:linked-source-attlist
class table_linked_source_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) table_filter_name_;
@ -151,7 +138,6 @@ public:
};
// table:table-source
class table_table_source : public office_element_impl<table_table_source>
{
public:
@ -172,7 +158,6 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table:columns
class table_columns
{
public:
@ -182,13 +167,11 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
office_element_ptr table_table_columns_;
office_element_ptr_array table_table_column_;
};
// table:columns-no-group
class table_columns_no_group: public office_element
{
public:
@ -204,7 +187,6 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
public:
table_columns_no_group();
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
@ -214,16 +196,13 @@ public:
static _CP_PTR(table_columns_no_group) create();
public:
table_columns table_columns_1_;
bool was_header_;
office_element_ptr table_table_header_columns_;
table_columns table_columns_2_;
table_columns table_columns_2_;
};
// table:columns-and-groups
class table_columns_and_groups
{
public:
@ -234,21 +213,18 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
// office_element_ptr table_table_column_group_;
// table_columns_no_group table_columns_no_group_;
office_element_ptr_array content_;
office_element_ptr_array content_;
};
// table:table-column-attlist
class table_table_column_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_style_name_;
odf_types::table_visibility table_visibility_; // default Visible
@ -256,7 +232,6 @@ public:
};
// table:table-column
class table_table_column : public office_element_impl<table_table_column>
{
public:
@ -279,10 +254,8 @@ public:
table_table_column_attlist table_table_column_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_column);
// table:table-columns
class table_table_columns : public office_element_impl<table_table_columns>
{
public:
@ -304,11 +277,8 @@ public:
office_element_ptr_array table_table_column_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns);
// table:table-header-columns
class table_table_header_columns : public office_element_impl<table_table_header_columns>
{
public:
@ -331,21 +301,17 @@ public:
office_element_ptr_array table_table_column_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_columns);
// table:table-column-group-attlist
class table_table_column_group_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
bool table_display_; // default true
};
// table:table-column-group
class table_table_column_group : public office_element_impl<table_table_column_group>
{
public:
@ -372,10 +338,8 @@ public:
table_table_column_group_attlist table_table_column_group_attlist_;
table_columns_and_groups table_columns_and_groups_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group);
// table:table-row
class table_table_row : public office_element_impl<table_table_row>
{
public:
@ -390,7 +354,6 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -398,14 +361,15 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
table_table_row_attlist table_table_row_attlist_;
bool empty();
bool empty_content_cells();
table_table_row_attlist attlist_;
office_element_ptr_array content_; // table-table-cell or table-covered-table-cell
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
// table:table-cell-content
class table_table_cell_content
{
public:
@ -417,13 +381,11 @@ public:
bool pptx_convert(oox::pptx_conversion_context & Context) ;
office_element_ptr_array elements_;
private:
// TODO table-cell-range-source
// TODO table-cell-range-source
// TODO table-detective
};
// table:table-cell
class table_table_cell : public office_element_impl<table_table_cell>
{
public:
@ -440,7 +402,6 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -450,16 +411,16 @@ private:
public:
bool last_cell_;
bool empty();
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
table_table_cell_attlist attlist_;
table_table_cell_attlist_extra attlist_extra_;
table_table_cell_content content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
// table:covered-table-cell
class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{
public:
@ -470,13 +431,12 @@ 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) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -487,16 +447,15 @@ private:
public:
bool last_cell_;
bool empty_;
bool empty();
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_content table_table_cell_content_;
table_table_cell_attlist attlist_;
table_table_cell_content content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell);
// table:table-rows
class table_table_rows : public office_element_impl<table_table_rows>
{
public:
@ -514,7 +473,6 @@ public:
table_table_rows()
{
}
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -525,10 +483,8 @@ public:
office_element_ptr_array table_table_row_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows);
// table:table-header-rows
class table_table_header_rows : public office_element_impl<table_table_header_rows>
{
public:
@ -543,7 +499,6 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -555,10 +510,8 @@ public:
office_element_ptr_array table_table_row_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// table:rows
class table_rows
{
public:
@ -569,13 +522,12 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
office_element_ptr table_table_rows_;
office_element_ptr_array table_table_row_;
void remove_equals_empty();
};
// table:rows-no-group
class table_rows_no_group : public office_element
{
public:
@ -593,8 +545,8 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
public:
table_rows_no_group();
std::wostream & text_to_stream(std::wostream & _Wostream) const;
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
@ -602,7 +554,6 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
bool was_header_;
table_rows table_rows_1_;
@ -611,21 +562,18 @@ public:
};
// table:rows-and-groups
class table_rows_and_groups
{
public:
table_rows_and_groups();
std::wostream & text_to_stream(std::wostream & _Wostream) const;
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
int get_count(){return content_.size();}//временно .. для группировок
public:
office_element_ptr_array content_;
//int type_;
//office_element_ptr table_table_row_group_;
@ -633,7 +581,6 @@ public:
};
// table:table-row-group-attlist
class table_table_row_group_attlist
{
public:
@ -643,7 +590,6 @@ public:
};
// table:table-row-group
class table_table_row_group : public office_element_impl<table_table_row_group>
{
public:
@ -669,10 +615,8 @@ public:
table_rows_and_groups table_rows_and_groups_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
// table:table
class table_table : public office_element_impl<table_table>
{
public:
@ -707,10 +651,8 @@ public:
//table-scenario
//office-forms
};
CP_REGISTER_OFFICE_ELEMENT2(table_table);
// table:shapes
class table_shapes : public office_element_impl<table_shapes>
{
public:
@ -732,7 +674,6 @@ private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_shapes);
}

View File

@ -31,6 +31,7 @@
*/
#include "table_data_pilot_tables.h"
#include "../formulasconvert/formulasconvert.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -47,16 +48,13 @@ namespace odf_reader {
const wchar_t * table_data_pilot_tables::ns = L"table";
const wchar_t * table_data_pilot_tables::name = L"data-pilot-tables";
void table_data_pilot_tables::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
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);
@ -75,21 +73,56 @@ void table_data_pilot_table::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"table:grand-total" , table_grand_total_);
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-filterbutton" , table_show_filterbutton_);
CP_APPLY_ATTR(L"table:show-target-range-address", table_show_target_range_address_);
CP_APPLY_ATTR(L"table:show-filter-button" , table_show_filter_button_);
CP_APPLY_ATTR(L"table:target-range-address" , table_target_range_address_);
}
void table_data_pilot_table::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" == Name)
CP_CREATE_ELEMENT (fields_);
else
CP_CREATE_ELEMENT (source_);
}
void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(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);
}
int index_view = Context.get_pivots_context().end_table();
if (index_view > 0)
{
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"));
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_field::ns = L"table";
@ -97,18 +130,66 @@ const wchar_t * table_data_pilot_field::name = L"data-pilot-field";
void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:source-field-name" , table_source_field_name_);
CP_APPLY_ATTR(L"table:orientation" , table_orientation_);
CP_APPLY_ATTR(L"table:used-hierarchy" , table_used_hierarchy_);
CP_APPLY_ATTR(L"table:function" , table_function_);
CP_APPLY_ATTR(L"loext:ignore-selected-page" , loext_ignore_selected_page_);
CP_APPLY_ATTR(L"table:selected-page" , table_selected_page_);
CP_APPLY_ATTR(L"table:is-data-layout-field" , table_is_data_layout_field_);
}
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)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(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());
if (table_function_)
{
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();
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_field_reference::ns = L"table";
const wchar_t * table_data_pilot_field_reference::name = L"data-pilot-field-reference";
void table_data_pilot_field_reference::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:field-name" , table_field_name_);
CP_APPLY_ATTR(L"table:member-name" , table_member_name_);
CP_APPLY_ATTR(L"table:member-type" , table_member_type_);
CP_APPLY_ATTR(L"table:type" , table_type_);
}
void table_data_pilot_field_reference::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_table::ns = L"table";
@ -116,18 +197,13 @@ const wchar_t * table_database_source_table::name = L"database-source-table";
void table_database_source_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:database-name" , table_database_name_);
CP_APPLY_ATTR(L"table:database-table-name" , table_database_table_name_);
}
void table_database_source_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_table::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_query::ns = L"table";
@ -135,18 +211,14 @@ const wchar_t * table_database_source_query::name = L"database-source-query";
void table_database_source_query::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:database-name" , table_database_name_);
CP_APPLY_ATTR(L"table:query-name" , table_query_name_);
}
void table_database_source_query::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_query::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_sql::ns = L"table";
@ -154,18 +226,14 @@ const wchar_t * table_database_source_sql::name = L"database-source-sql";
void table_database_source_sql::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:database-name" , table_database_name_);
CP_APPLY_ATTR(L"table:parse-sql-statement" , table_parse_sql_statement_);
CP_APPLY_ATTR(L"table:sql-statement" , table_sql_statement_);
}
void table_database_source_sql::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_sql::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_source_cell_range::ns = L"table";
@ -173,6 +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: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)
@ -181,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);
}
}
//-------------------------------------------------------------------------------------------------
@ -192,18 +266,213 @@ const wchar_t * table_source_service::name = L"source-service";
void table_source_service::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:name", table_name_);
CP_APPLY_ATTR(L"table:object-name", table_object_name_);
CP_APPLY_ATTR(L"table:password", table_password_);
CP_APPLY_ATTR(L"table:source-name", table_source_name_);
CP_APPLY_ATTR(L"table:user-name", table_user_name_);
}
void table_source_service::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
void table_source_service::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_level::ns = L"table";
const wchar_t * table_data_pilot_level::name = L"data-pilot-level";
void table_data_pilot_level::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:show-empty-address", table_show_empty_);
}
void table_data_pilot_level::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
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)
{
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";
const wchar_t * table_data_pilot_groups::name = L"data-pilot-groups";
void table_data_pilot_groups::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:date-start", table_date_start_);
CP_APPLY_ATTR(L"table:date-end", table_date_end_);
CP_APPLY_ATTR(L"table:start", table_start);
CP_APPLY_ATTR(L"table:end", table_end_);
CP_APPLY_ATTR(L"table:grouped-by", table_grouped_by_);
CP_APPLY_ATTR(L"table:source-field-name", table_source_field_name_);
CP_APPLY_ATTR(L"table:step", table_step);
}
void table_data_pilot_groups::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_source_service::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_data_pilot_groups::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_group::ns = L"table";
const wchar_t * table_data_pilot_group::name = L"data-pilot-group";
void table_data_pilot_group::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:name", table_name_);
}
void table_data_pilot_group::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_group::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_members::ns = L"table";
const wchar_t * table_data_pilot_members::name = L"data-pilot-members";
void table_data_pilot_members::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_members::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_member::ns = L"table";
const wchar_t * table_data_pilot_member::name = L"data-pilot-member";
void table_data_pilot_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"table:name", table_name_);
CP_APPLY_ATTR(L"table:show-details",table_show_details_);
}
void table_data_pilot_member::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_group_member::ns = L"table";
const wchar_t * table_data_pilot_group_member::name = L"data-pilot-group-member";
void table_data_pilot_group_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:name", table_name_);
}
void table_data_pilot_group_member::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_subtotals::ns = L"table";
const wchar_t * table_data_pilot_subtotals::name = L"data-pilot-subtotals";
void table_data_pilot_subtotals::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_subtotals::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_subtotal::ns = L"table";
const wchar_t * table_data_pilot_subtotal::name = L"data-pilot-subtotal";
void table_data_pilot_subtotal::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:function", table_function_);
}
void table_data_pilot_subtotal::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_layout_info::ns = L"table";
const wchar_t * table_data_pilot_layout_info::name = L"data-pilot-layout-info";
void table_data_pilot_layout_info::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:add-empty-lines" , table_add_empty_lines_);
CP_APPLY_ATTR(L"table:layout-mode" , table_layout_mode_);
}
void table_data_pilot_layout_info::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_sort_info::ns = L"table";
const wchar_t * table_data_pilot_sort_info::name = L"data-pilot-sort-info";
void table_data_pilot_sort_info::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:data-field" , table_data_field_);
CP_APPLY_ATTR(L"table:order" , table_order_);
CP_APPLY_ATTR(L"table:sort-mode" , table_sort_mode_);
}
void table_data_pilot_sort_info::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_display_info::ns = L"table";
const wchar_t * table_data_pilot_display_info::name = L"data-pilot-display-info";
void table_data_pilot_display_info::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:data-field" , table_data_field_);
CP_APPLY_ATTR(L"table:display-member-mode" , table_display_member_mode_);
CP_APPLY_ATTR(L"table:enabled" , table_enabled_);
CP_APPLY_ATTR(L"table:member-count" , table_member_count_);
}
void table_data_pilot_display_info::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
}
}

View File

@ -41,6 +41,11 @@
#include "datatypes/common_attlists.h"
#include "datatypes/bool.h"
#include "datatypes/grandtotal.h"
#include "datatypes/membertype.h"
#include "datatypes/tableorientation.h"
#include "datatypes/tabletype.h"
#include "datatypes/tablefunction.h"
#include "datatypes/tableorder.h"
namespace cpdoccore {
namespace odf_reader {
@ -57,11 +62,11 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
@ -82,17 +87,19 @@ 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_;
_CP_OPT(odf_types::grand_total)table_grand_total_;
_CP_OPT(odf_types::Bool) table_identify_categories_;
_CP_OPT(odf_types::Bool) table_ignore_empty_rows_;
_CP_OPT(odf_types::Bool) table_show_filterbutton_;
_CP_OPT(odf_types::Bool) table_show_target_range_address_;
_CP_OPT(odf_types::Bool) table_show_filter_button_;
office_element_ptr_array content_;
office_element_ptr source_;
office_element_ptr_array fields_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_table);
@ -113,11 +120,46 @@ 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:
_CP_OPT(std::wstring) table_source_field_name_;
_CP_OPT(odf_types::table_orientation) table_orientation_;
_CP_OPT(int) table_used_hierarchy_;
_CP_OPT(odf_types::table_function) table_function_;
_CP_OPT(odf_types::Bool) loext_ignore_selected_page_;
_CP_OPT(std::wstring) table_selected_page_;
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
office_element_ptr reference_;
office_element_ptr level_;
office_element_ptr groups_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field);
//-------------------------------------------------------------------------------------
class table_data_pilot_field_reference : public office_element_impl<table_data_pilot_field_reference>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotFieldReference;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
_CP_OPT(odf_types::table_type) table_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field_reference);
//-------------------------------------------------------------------------------------
class table_database_source_table : public office_element_impl<table_database_source_table>
{
@ -132,9 +174,11 @@ public:
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);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
office_element_ptr_array content_;
public:
_CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_database_table_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_source_table);
@ -153,9 +197,11 @@ public:
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);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
office_element_ptr_array content_;
public:
_CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_query_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_source_query);
@ -174,9 +220,12 @@ public:
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);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
office_element_ptr_array content_;
public:
_CP_OPT(std::wstring) table_database_name_;
_CP_OPT(odf_types::Bool)table_parse_sql_statement_;
_CP_OPT(std::wstring) table_sql_statement_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_source_sql);
@ -197,7 +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);
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);
@ -216,12 +267,276 @@ public:
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);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
office_element_ptr_array content_;
public:
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_object_name_;
_CP_OPT(std::wstring) table_password_;
_CP_OPT(std::wstring) table_source_name_;
_CP_OPT(std::wstring) table_user_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_source_service);
//-------------------------------------------------------------------------------------
class table_data_pilot_level : public office_element_impl<table_data_pilot_level>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotLevel;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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 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);
//-------------------------------------------------------------------------------------
class table_data_pilot_groups : public office_element_impl<table_data_pilot_groups>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotGroups;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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.
_CP_OPT(std::wstring) table_end_; //double 18.2 or auto.
_CP_OPT(std::wstring) table_grouped_by_; //seconds, minutes, hours, days, months, quarters or years.
_CP_OPT(std::wstring) table_source_field_name_;
_CP_OPT(double) table_step;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_groups);
//-------------------------------------------------------------------------------------
class table_data_pilot_group : public office_element_impl<table_data_pilot_group>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotGroup;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_group);
//-------------------------------------------------------------------------------------
class table_data_pilot_members : public office_element_impl<table_data_pilot_members>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotMembers;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_members);
//-------------------------------------------------------------------------------------
class table_data_pilot_member : public office_element_impl<table_data_pilot_member>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotMember;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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(odf_types::Bool) table_display_;
_CP_OPT(odf_types::Bool) table_show_details_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_member);
//-------------------------------------------------------------------------------------
class table_data_pilot_group_member : public office_element_impl<table_data_pilot_group_member>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotGroupMember;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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);
//-------------------------------------------------------------------------------------
class table_data_pilot_subtotals : public office_element_impl<table_data_pilot_subtotals>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotSubtotals;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_subtotals);
//-------------------------------------------------------------------------------------
class table_data_pilot_subtotal : public office_element_impl<table_data_pilot_subtotal>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotSubtotal;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_subtotal);
//-------------------------------------------------------------------------------------
class table_data_pilot_layout_info : public office_element_impl<table_data_pilot_layout_info>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataLayoutInfo;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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.
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_layout_info);
//-------------------------------------------------------------------------------------
class table_data_pilot_sort_info : public office_element_impl<table_data_pilot_sort_info>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataSortInfo;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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.
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_sort_info);
//-------------------------------------------------------------------------------------
class table_data_pilot_display_info : public office_element_impl<table_data_pilot_display_info>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataDisplayInfo;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
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_;
_CP_OPT(unsigned int) table_member_count_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_display_info);
//-------------------------------------------------------------------------------------
}
}

View File

@ -41,11 +41,11 @@
#include <cpdoccore/odf/odf_document.h>
namespace cpdoccore {
using namespace odf_types;
namespace odf_reader {
// table:table-source
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_database_ranges::ns = L"table";
const wchar_t * table_database_ranges::name = L"database-ranges";
@ -66,8 +66,7 @@ void table_database_ranges::xlsx_convert(oox::xlsx_conversion_context & Context)
}
}
// table:named-range
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_database_range::ns = L"table";
const wchar_t * table_database_range::name = L"database-range";
@ -96,7 +95,7 @@ void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
if (table_orientation_)
Context.get_table_context().set_database_orientation(*table_orientation_ == L"row" ? true : false);
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
if (table_contains_header_)
Context.get_table_context().set_database_header(table_contains_header_->get());
@ -109,8 +108,7 @@ void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_table_context().end_database_range();
}
// table:sort
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_sort::ns = L"table";
const wchar_t * table_sort::name = L"sort";
@ -118,25 +116,24 @@ void table_sort::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
if (L"table" == Ns && L"sort-by" == Name)
{
CP_CREATE_ELEMENT(table_sort_by_);
CP_CREATE_ELEMENT(content_);
}
}
void table_sort::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < table_sort_by_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
table_sort_by * sort_by = dynamic_cast<table_sort_by*>(table_sort_by_[i].get());
table_sort_by * sort_by = dynamic_cast<table_sort_by*>(content_[i].get());
int descending = 1;
if ((sort_by->table_order_) && (sort_by->table_order_.get() == L"descending"))
if ((sort_by->table_order_) && (sort_by->table_order_->get_type() == table_order::descending))
descending = 2;
Context.get_table_context().add_database_sort(sort_by->table_field_number_, descending);
}
}
// table:sort-by
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_sort_by::ns = L"table";
const wchar_t * table_sort_by::name = L"sort-by";
@ -147,6 +144,98 @@ void table_sort_by::add_attributes(xml::attributes_wc_ptr const & Attributes)
CP_APPLY_ATTR(L"table:order" , table_order_);
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter::ns = L"table";
const wchar_t * table_filter::name = L"filter";
void table_filter::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:condition-source", table_condition_source_);
CP_APPLY_ATTR(L"table:condition-source-range-address", table_condition_source_range_address_);
CP_APPLY_ATTR(L"table:display-duplicates", table_display_duplicates_);
CP_APPLY_ATTR(L"table:target-range-address", table_target_range_address_);
}
void table_filter::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_or::ns = L"table";
const wchar_t * table_filter_or::name = L"filter-or";
void table_filter_or::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_or::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_and::ns = L"table";
const wchar_t * table_filter_and::name = L"filter-and";
void table_filter_and::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_and::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_condition::ns = L"table";
const wchar_t * table_filter_condition::name = L"filter-condition";
void table_filter_condition::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:case-sensitive", table_case_sensitive_);
CP_APPLY_ATTR(L"table:data-type", table_data_type_);
CP_APPLY_ATTR(L"table:field-number", table_field_number_);
CP_APPLY_ATTR(L"table:operator", table_operator_);
CP_APPLY_ATTR(L"table:value", table_value_);
}
void table_filter_condition::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_set_item::ns = L"table";
const wchar_t * table_filter_set_item::name = L"filter-set-item";
void table_filter_set_item::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:value", table_value_);
}
void table_filter_set_item::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
}
}

View File

@ -40,14 +40,14 @@
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/tableorientation.h"
#include "datatypes/tableorder.h"
#include "../docx/xlsxconversioncontext.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_reader {
// table:named-expressions
class table_database_ranges : public office_element_impl<table_database_ranges>
{
public:
@ -68,8 +68,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_ranges);
//-------------------------------------------------------------------------------------------------------------
// table:named-range
class table_database_range: public office_element_impl<table_database_range>
{
public:
@ -85,11 +85,11 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_target_range_address_;
_CP_OPT(Bool) table_display_filter_buttons_;
_CP_OPT(Bool) table_contains_header_;
_CP_OPT(std::wstring) table_orientation_;
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_target_range_address_;
_CP_OPT(odf_types::Bool) table_display_filter_buttons_;
_CP_OPT(odf_types::Bool) table_contains_header_;
_CP_OPT(odf_types::table_orientation) table_orientation_;
//table:refresh-delay
office_element_ptr_array content_;
@ -99,8 +99,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_range);
//-------------------------------------------------------------------------------------------------------------
// table:sort
class table_sort: public office_element_impl<table_sort>
{
public:
@ -116,7 +116,7 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array table_sort_by_;
office_element_ptr_array content_;
//attr
//table:algorithm
//table:country
@ -125,8 +125,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_sort);
//-------------------------------------------------------------------------------------------------------------
// table:sort-by
class table_sort_by: public office_element_impl<table_sort_by>
{
public:
@ -140,11 +140,124 @@ public:
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){}
int table_field_number_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(std::wstring) table_order_;
int table_field_number_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(odf_types::table_order) table_order_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_sort_by);
//-------------------------------------------------------------------------------------------------------------
class table_filter: public office_element_impl<table_filter>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilter;
CPDOCCORE_DEFINE_VISITABLE()
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);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_condition_source_; //self or cell-range.
_CP_OPT(std::wstring) table_condition_source_range_address_; //cellRangeAddress
_CP_OPT(odf_types::Bool) table_display_duplicates_;
_CP_OPT(std::wstring) table_target_range_address_;//cellRangeAddress
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter);
//------------------------------------------------------------------------------
class table_filter_and: public office_element_impl<table_filter_and>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterAnd;
CPDOCCORE_DEFINE_VISITABLE()
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);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_and);
//-------------------------------------------------------------------------------------------------------------
class table_filter_or: public office_element_impl<table_filter_or>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterOr;
CPDOCCORE_DEFINE_VISITABLE()
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);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_or);
//-------------------------------------------------------------------------------------------------------------
class table_filter_condition: public office_element_impl<table_filter_condition>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterCondition;
CPDOCCORE_DEFINE_VISITABLE()
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);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_case_sensitive_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(unsigned int) table_field_number_;
_CP_OPT(std::wstring) table_operator_;
_CP_OPT(std::wstring) table_value_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_condition);
//-------------------------------------------------------------------------------------------------------------
class table_filter_set_item: public office_element_impl<table_filter_set_item>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterSetItem;
CPDOCCORE_DEFINE_VISITABLE()
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){}
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_value_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_set_item);
//-------------------------------------------------------------------------------------------------------------
}
}

View File

@ -67,10 +67,10 @@ void table_table_row::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & _Wostream = Context.output_stream();
const std::wstring styleName = table_table_row_attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyle = table_table_row_attlist_.table_default_cell_style_name_.get_value_or(L"");
const std::wstring styleName = attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyle = attlist_.table_default_cell_style_name_.get_value_or(L"");
for (unsigned int i = 0; i < table_table_row_attlist_.table_number_rows_repeated_; ++i)
for (unsigned int i = 0; i < attlist_.table_number_rows_repeated_; ++i)
{
_Wostream << L"<w:tr>";
const style_instance * inst =
@ -259,7 +259,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & _Wostream = Context.output_stream();
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
for (unsigned int r = 0; r < attlist_.table_number_columns_repeated_; ++r)
{
int pushTextPropCount = 0;
@ -267,24 +267,24 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
_Wostream << L"<w:tc>";
_Wostream << L"<w:tcPr>";
const std::wstring styleName = table_table_cell_attlist_.table_style_name_.get_value_or(L"");
const std::wstring styleName = attlist_.table_style_name_.get_value_or(L"");
//_Wostream << L"<w:tcW w:w=\"0\" w:type=\"auto\" />";
if (table_table_cell_attlist_extra_.table_number_rows_spanned_ > 1)
if (attlist_extra_.table_number_rows_spanned_ > 1)
{
_Wostream << L"<w:vMerge w:val=\"restart\" />";
Context.get_table_context().set_rows_spanned(Context.get_table_context().current_column(),
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1,
table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1,
attlist_extra_.table_number_rows_spanned_ - 1,
attlist_extra_.table_number_columns_spanned_ - 1,
styleName
);
}
if (table_table_cell_attlist_extra_.table_number_columns_spanned_ > 1)
if (attlist_extra_.table_number_columns_spanned_ > 1)
{
_Wostream << L"<w:gridSpan w:val=\"" << table_table_cell_attlist_extra_.table_number_columns_spanned_ << "\" />";
Context.get_table_context().set_columns_spanned(table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1);
_Wostream << L"<w:gridSpan w:val=\"" << attlist_extra_.table_number_columns_spanned_ << "\" />";
Context.get_table_context().set_columns_spanned(attlist_extra_.table_number_columns_spanned_ - 1);
}
const style_instance * inst =
@ -344,7 +344,7 @@ void table_table_cell::docx_convert(oox::docx_conversion_context & Context)
}
// если одержимое не содержит ниодного параграфа, то добавляем параграф, иначе word считает файл битым
if (!table_table_cell_content_.docx_convert(Context))
if (!content_.docx_convert(Context))
{
_Wostream << emptyPar;
}
@ -361,11 +361,11 @@ void table_covered_table_cell::docx_convert(oox::docx_conversion_context & Conte
{
std::wostream & _Wostream = Context.output_stream();
for (unsigned int i = 0; i < table_table_cell_attlist_.table_number_columns_repeated_; ++i)
for (unsigned int i = 0; i < attlist_.table_number_columns_repeated_; ++i)
{
if (Context.get_table_context().start_covered_cell(Context))
{
if (!table_table_cell_content_.docx_convert(Context))
if (!content_.docx_convert(Context))
{
_Wostream << emptyPar;
}

View File

@ -70,10 +70,10 @@ void table_table_row::pptx_convert(oox::pptx_conversion_context & Context)
{
std::wostream & _Wostream = Context.get_table_context().tableData();
const std::wstring styleName = table_table_row_attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyle = table_table_row_attlist_.table_default_cell_style_name_.get_value_or(L"");
const std::wstring styleName = attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyle = attlist_.table_default_cell_style_name_.get_value_or(L"");
for (unsigned int i = 0; i < table_table_row_attlist_.table_number_rows_repeated_; ++i)
for (unsigned int i = 0; i < attlist_.table_number_rows_repeated_; ++i)
{
int height = 0;
@ -323,7 +323,7 @@ void table_table_cell::pptx_convert(oox::pptx_conversion_context & Context)
CP_XML_WRITER(_Wostream)
{
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
for (unsigned int r = 0; r < attlist_.table_number_columns_repeated_; ++r)
{
Context.get_table_context().start_cell();
CP_XML_NODE(L"a:tc")
@ -352,35 +352,35 @@ void table_table_cell::pptx_convert(oox::pptx_conversion_context & Context)
style_inst = Context.root()->odf_context().styleContainer().style_by_name(style_name, style_family::TableCell,false);
if (style_inst) style_instances.push_back(style_inst);
}
style_name = table_table_cell_attlist_.table_style_name_.get_value_or(L"");
style_name = attlist_.table_style_name_.get_value_or(L"");
if (!style_name.empty())
{
style_inst = Context.root()->odf_context().styleContainer().style_by_name(style_name, style_family::TableCell,false);
if (style_inst) style_instances.push_back(style_inst);
}
if (table_table_cell_attlist_extra_.table_number_rows_spanned_ > 1)
if (attlist_extra_.table_number_rows_spanned_ > 1)
{
CP_XML_ATTR(L"rowSpan" , table_table_cell_attlist_extra_.table_number_rows_spanned_);
CP_XML_ATTR(L"rowSpan" , attlist_extra_.table_number_rows_spanned_);
CP_XML_ATTR(L"vMerge", 1);
Context.get_table_context().set_rows_spanned(Context.get_table_context().current_column(),
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1,
table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1,
attlist_extra_.table_number_rows_spanned_ - 1,
attlist_extra_.table_number_columns_spanned_ - 1,
style_name);
}
if (table_table_cell_attlist_extra_.table_number_columns_spanned_ > 1)
if (attlist_extra_.table_number_columns_spanned_ > 1)
{
//CP_XML_ATTR(L"hMerge", true);
CP_XML_ATTR(L"gridSpan" , table_table_cell_attlist_extra_.table_number_columns_spanned_);
CP_XML_ATTR(L"gridSpan" , attlist_extra_.table_number_columns_spanned_);
Context.get_table_context().set_columns_spanned(table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1);
Context.get_table_context().set_columns_spanned(attlist_extra_.table_number_columns_spanned_ - 1);
}
Context.get_text_context().start_object();
bool presentText = table_table_cell_content_.pptx_convert(Context);
bool presentText = content_.pptx_convert(Context);
std::wstring cellContent = Context.get_text_context().end_object();
@ -408,11 +408,11 @@ void table_covered_table_cell::pptx_convert(oox::pptx_conversion_context & Conte
{
std::wostream & _Wostream = Context.get_table_context().tableData();
for (unsigned int i = 0; i < table_table_cell_attlist_.table_number_columns_repeated_; ++i)
for (unsigned int i = 0; i < attlist_.table_number_columns_repeated_; ++i)
{
if (Context.get_table_context().start_covered_cell(Context))
{
if (!table_table_cell_content_.pptx_convert(Context))
if (!content_.pptx_convert(Context))
{
_Wostream << emptyParTable;
}

View File

@ -78,12 +78,23 @@ 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;
const std::wstring rowStyleName = table_table_row_attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyleName = table_table_row_attlist_.table_default_cell_style_name_.get_value_or( L"");
const std::wstring rowStyleName = attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyleName = attlist_.table_default_cell_style_name_.get_value_or( L"");
style_instance * instStyle_CellDefault =
Context.root()->odf_context().styleContainer().style_by_name(defaultCellStyleName, style_family::TableCell,false/*false*/);
@ -140,9 +151,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
}
int row_current = Context.current_table_row() + 1;
bool hidden = table_table_row_attlist_.table_visibility_.get_type() == table_visibility::Collapse;
bool hidden = attlist_.table_visibility_.get_type() == table_visibility::Collapse;
for (unsigned int i = 0; i < table_table_row_attlist_.table_number_rows_repeated_; ++i)
for (unsigned int i = 0; i < attlist_.table_number_rows_repeated_; ++i)
{
Context.start_table_row(rowStyleName, defaultCellStyleName);
@ -214,20 +225,20 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if (Context.is_empty_row())
{
skip_next_row = true;
if (table_table_row_attlist_.table_number_rows_repeated_ > 0xf000)
if (attlist_.table_number_rows_repeated_ > 0xf000)
break;//Уведомление_оручении.ods (1 лист)
}
if (content_.size() > 0 && table_table_row_attlist_.table_number_rows_repeated_ > 1000)
if (content_.size() > 0 && attlist_.table_number_rows_repeated_ > 1000)
{
table_table_cell * table_cell = dynamic_cast<table_table_cell *>(content_[0].get());
if ((table_cell) && (table_cell->table_table_cell_attlist_.table_number_columns_repeated_ > 1000))
if ((table_cell) && (table_cell->attlist_.table_number_columns_repeated_ > 1000))
{
break;//Уведомление_оручении.ods (2 лист)
}
}
}
Context.get_table_metrics().add_rows(table_table_row_attlist_.table_number_rows_repeated_, !hidden ? row_height : 0.0);
Context.get_table_metrics().add_rows(attlist_.table_number_rows_repeated_, !hidden ? row_height : 0.0);
}
@ -259,20 +270,22 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
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->table_table_row_attlist_.table_number_rows_repeated_ > 1000 &&
row_last_1->table_table_row_attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->table_table_row_attlist_.table_number_rows_repeated_ > 0xf000)
if (row_last->empty_content_cells() && row_last_1->empty_content_cells())
{
std::wstring style = row_last->table_table_row_attlist_.table_style_name_.get_value_or(L"");
std::wstring style_1 = row_last->table_table_row_attlist_.table_style_name_.get_value_or(L"");
if (style == style_1)//check for empty also ????
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)
{
row_last_1->table_table_row_attlist_.table_number_rows_repeated_ = 1024;
table_table_row_.pop_back();
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();
}
}
}
}
for (size_t i = 0; i < table_table_row_.size(); i++)
{
@ -301,11 +314,11 @@ void table_rows_and_groups::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_table_row_group::xlsx_convert(oox::xlsx_conversion_context & Context)
{
int count = table_rows_and_groups_.get_count();
size_t count = table_rows_and_groups_.content_.size();
int level = 1;
Context.set_table_row_group(count,table_table_row_group_attlist_.table_display_,level);
Context.set_table_row_group( (int)count, table_table_row_group_attlist_.table_display_, level);
table_rows_and_groups_.xlsx_convert(Context);
}
@ -328,6 +341,27 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.start_table(tableName, tableStyleName);
table_columns_and_groups_.xlsx_convert(Context);
// check last rows for equal style and empties - collapsed
//<table:table-row table:style-name="ro3" table:number-rows-repeated="65353">
// <table:table-cell table:style-name="ce14" table:number-columns-repeated="5"/>
// <table:table-cell table:number-columns-repeated="1019"/>
//</table:table-row>
//<table:table-row table:style-name="ro3" table:number-rows-repeated="983017">
// <table:table-cell table:number-columns-repeated="1024"/>
//</table:table-row>
//<table:table-row table:style-name="ro3">
// <table:table-cell table:number-columns-repeated="1024"/>
//</table:table-row>
if (table_rows_and_groups_.content_.empty() == false && table_rows_and_groups_.content_.back()->get_type() == typeTableTableRowNoGroup)
{
table_rows_no_group * rows = dynamic_cast<table_rows_no_group*>(table_rows_and_groups_.content_.back().get());
rows->table_rows_1_.remove_equals_empty();
rows->table_rows_2_.remove_equals_empty();
}
table_rows_and_groups_.xlsx_convert(Context);
if (table_shapes_)
@ -607,11 +641,11 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std::wostream & strm = Context.current_sheet().sheetData();
const common_value_and_type_attlist & attr = table_table_cell_attlist_.common_value_and_type_attlist_;
const common_value_and_type_attlist & attr = attlist_.common_value_and_type_attlist_;
office_value_type::type odf_value_type = office_value_type::Custom;
oox::XlsxCellType::type t_val = oox::XlsxCellType::s;
std::wstring formula = table_table_cell_attlist_.table_formula_.get_value_or(L"");
std::wstring formula = attlist_.table_formula_.get_value_or(L"");
std::wstring number_val;
_CP_OPT(bool) bool_val;
@ -626,11 +660,11 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
bool is_data_visible = false;
// вычислить стиль для ячейки
std::wstring cellStyleName = table_table_cell_attlist_.table_style_name_.get_value_or(L"");
std::wstring cellStyleName = attlist_.table_style_name_.get_value_or(L"");
std::wstring columnStyleName = Context.get_table_context().default_column_cell_style();
std::wstring rowStyleName = Context.get_table_context().default_row_cell_style();
if (table_table_cell_attlist_.table_number_columns_repeated_ > 1)
if (attlist_.table_number_columns_repeated_ > 1)
columnStyleName.clear(); // могут быть разные стили колонок Book 24.ods
odf_read_context & odfContext = Context.root()->odf_context();
@ -760,15 +794,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
if ( table_table_cell_content_.elements_.size() > 0 ||
if ( content_.elements_.size() > 0 ||
!formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
( t_val == oox::XlsxCellType::b && bool_val) ||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
if (table_table_cell_attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
if (attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
int cell_repeated_max = Context.current_table_column() + table_table_cell_attlist_.table_number_columns_repeated_ + 1;
int cell_repeated_max = Context.current_table_column() + attlist_.table_number_columns_repeated_ + 1;
if (cell_repeated_max >= 1024 && cellStyleName.empty() && last_cell_ && !is_data_visible)
{//Book 24.ods
@ -780,15 +814,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
xfId_last_set = Context.get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, num_format, false, is_style_visible);
}
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
for (unsigned int r = 0; r < attlist_.table_number_columns_repeated_; ++r)
{
Context.start_table_cell ( formula, table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1 ,
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1 );
Context.start_table_cell ( formula, attlist_extra_.table_number_columns_spanned_ - 1 ,
attlist_extra_.table_number_rows_spanned_ - 1 );
if (is_style_visible)
Context.set_current_cell_style_id(xfId_last_set);
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context, &textFormatProperties);
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
@ -813,12 +847,12 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_NODE(L"f")
{
if (table_table_cell_attlist_extra_.table_number_matrix_columns_spanned_ && table_table_cell_attlist_extra_.table_number_matrix_rows_spanned_)
if (attlist_extra_.table_number_matrix_columns_spanned_ && attlist_extra_.table_number_matrix_rows_spanned_)
{
std::wstring ref = oox::getCellAddress(Context.current_table_column(), Context.current_table_row());
ref += L":";
ref += oox::getCellAddress(Context.current_table_column() + *table_table_cell_attlist_extra_.table_number_matrix_columns_spanned_ - 1,
Context.current_table_row() + *table_table_cell_attlist_extra_.table_number_matrix_rows_spanned_ - 1);
ref += oox::getCellAddress(Context.current_table_column() + *attlist_extra_.table_number_matrix_columns_spanned_ - 1,
Context.current_table_row() + *attlist_extra_.table_number_matrix_rows_spanned_ - 1);
CP_XML_ATTR(L"ref", ref);
CP_XML_ATTR(L"t", L"array");
CP_XML_ATTR(L"aca", false);
@ -854,7 +888,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
empty_cell_count++;
//Уведомление_оручении.ods - 13 повторов пустых с cellStyle=NULL - нужные !!!
if (empty_cell_count > 19 && last_cell_&& (table_table_cell_attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL))
if (empty_cell_count > 19 && last_cell_&& (attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL))
{//пишем простыню только если задан стиль тока для этих ячеек
skip_next_cell = true;
}
@ -875,9 +909,9 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
{
std::wostream & strm = Context.current_sheet().sheetData();
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context, NULL);
const int sharedStringId = content_.xlsx_convert(Context, NULL);
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
for (unsigned int r = 0; r < attlist_.table_number_columns_repeated_; ++r)
{
Context.start_table_covered_cell();
const int xfId = Context.get_current_cell_style_id();

View File

@ -697,6 +697,14 @@
RelativePath="..\src\odf\datatypes\mathvariant.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\membertype.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\membertype.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\noteclass.cpp"
>
@ -909,6 +917,14 @@
RelativePath="..\src\odf\datatypes\tablecentering.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablemode.cpp"
>
@ -917,6 +933,30 @@
RelativePath="..\src\odf\datatypes\tablemode.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorder.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorder.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorientation.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorientation.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tabletype.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tabletype.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablevisibility.cpp"
>

View File

@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;&quot;../../DesktopEditor/freetype-2.5.2/include&quot;"
AdditionalIncludeDirectories="../include;&quot;../../DesktopEditor/freetype-2.5.2/include&quot;;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -718,6 +718,14 @@
RelativePath="..\src\docx\xlsx_package.h"
>
</File>
<File
RelativePath="..\src\docx\xlsx_pivots_context.cpp"
>
</File>
<File
RelativePath="..\src\docx\xlsx_pivots_context.h"
>
</File>
<File
RelativePath="..\src\docx\xlsx_row_spanned.h"
>
@ -1695,6 +1703,14 @@
RelativePath="..\src\odf\table_xlsx.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.h"
>
</File>
<File
RelativePath="..\src\odf\text_content.cpp"
>

View File

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

View File

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

View File

@ -32,8 +32,6 @@
#include "abstract_xml.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace odf_writer {

View File

@ -31,8 +31,6 @@
*/
#include "calcext_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -86,9 +84,9 @@ void calcext_conditional_formats::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -115,9 +113,9 @@ void calcext_conditional_format::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
BOOST_REVERSE_FOREACH(const office_element_ptr & item, content_)
for (size_t i = content_.size() - 1; i >= 0; i--)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -144,9 +142,9 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
{
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -170,9 +168,9 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -198,9 +196,9 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
{
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
@ -68,11 +67,11 @@ void draw_base::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void draw_base::serialize(std::wostream & _Wostream)
void draw_base::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
void draw_base::serialize_attlist(CP_ATTR_NODE)

View File

@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/regex.h>
@ -88,9 +87,9 @@ void draw_image::serialize(std::wostream & _Wostream)
if (office_binary_data_)office_binary_data_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -136,9 +135,9 @@ void draw_chart::serialize(std::wostream & _Wostream)
draw_chart_attlist_.serialize(CP_GET_XML_NODE());
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -167,9 +166,9 @@ void draw_g::serialize(std::wostream & _Wostream)
{
common_draw_attlists_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -430,16 +430,15 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, draw_equation_)
for (size_t i = 0; i < draw_equation_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_equation_[i]->serialize(CP_XML_STREAM());
}
BOOST_FOREACH(office_element_ptr & elm, draw_handle_)
for (size_t i = 0; i < draw_handle_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_handle_[i]->serialize(CP_XML_STREAM());
}
}
}
}

View File

@ -32,8 +32,6 @@
#include "list.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -80,9 +78,9 @@ void text_list_item::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -129,9 +127,9 @@ void text_list_header::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -34,7 +34,6 @@
#include "odf_rels.h"
#include <boost/regex.h>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <cpdoccore/xml/utils.h>
@ -85,11 +84,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
std::wstring output_path ;
BOOST_FOREACH(item const & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
if (elm.oox_ref == input_path)
if (items_[i].oox_ref == input_path)
{
output_path = elm.odf_ref;
output_path = items_[i].odf_ref;
break;
}
}
@ -110,12 +109,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
}
void _mediaitems::dump_rels(rels & Rels, std::wstring local_path)
{
size_t i = 0;
BOOST_FOREACH(item & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
Rels.add( relationship(
utils::media::get_rel_type(elm.type),
local_path + elm.odf_ref)
Rels.add( relationship(
utils::media::get_rel_type(items_[i].type),
local_path + items_[i].odf_ref)
);
}

View File

@ -33,7 +33,6 @@
#include "mediaitems_utils.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore {

View File

@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/xmlchar.h>
@ -67,13 +64,13 @@ void number_style_base::serialize(std::wostream & strm)
if (style_text_properties_)
style_text_properties_->serialize(strm);
BOOST_FOREACH(office_element_ptr & elm, style_map_)
{
elm->serialize(strm);
for (size_t i = 0; i < style_map_.size(); i++)
{
style_map_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(strm);
content_[i]->serialize(strm);
}
}
void number_style_base::serialize(CP_ATTR_NODE)
@ -166,9 +163,9 @@ void number_text::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -194,10 +191,10 @@ void number_embedded_text::serialize(std::wostream & strm)
{
CP_XML_ATTR_OPT(L"number:position", number_position_);
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}
}
@ -228,10 +225,10 @@ void number_number::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"number:min-integer-digits", number_min_integer_digits_);
CP_XML_ATTR_OPT(L"number:grouping", number_grouping_);
BOOST_FOREACH(office_element_ptr & elm, number_embedded_text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < number_embedded_text_.size(); i++)
{
number_embedded_text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -336,9 +333,9 @@ void number_text_content::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
#include <cpdoccore/xml/simple_xml_writer.h>
@ -92,9 +90,10 @@ namespace odf_writer
///////////////
void manifect_file::add_rels(rels & r)
{
BOOST_FOREACH(relationship & item, r.relationships())
std::vector<relationship> & rels = r.relationships();
for (size_t i = 0; i < rels.size(); i++)
{
rels_.add(item);
rels_.add(rels[i]);
}
}
manifect_file::manifect_file(std::wstring t)
@ -188,13 +187,14 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeMedia)
if (items[i].type == _mediaitems::typeMedia)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}
}
@ -212,15 +212,16 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Pictures";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeImage && item.oox_ref.length()>0)
if (items[i].type == _mediaitems::typeImage && items[i].oox_ref.length()>0)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
try
{
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}catch (...)
{
}
@ -289,13 +290,12 @@ namespace odf_writer
{
if (base_)base_->write(RootPath);
long count = 0;
BOOST_FOREACH(const element_ptr & item, objects_)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + item->local_path;
for (size_t i = 0; i < objects_.size(); i++)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + objects_[i]->local_path;
NSDirectory::CreateDirectory(path);
item->write(path);
objects_[i]->write(path);
}
if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>

View File

@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
@ -134,16 +132,15 @@ void odf_conversion_context::end_document()
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
for (size_t i = 0; i < object.content_styles.size(); i++)
{
elm->serialize(content_root_->styles());
object.content_styles[i]->serialize(content_root_->styles());
}
package::content_simple_ptr content_style_ = package::content_simple::create();
BOOST_FOREACH(const office_element_ptr & elm, object.styles)
for (size_t i = 0; i < object.styles.size(); i++)
{// мастер-пейджы, заданные заливки (градиенты, битмапы), дефолтные стили, колонтитулы, разметки, заметки,...
elm->serialize(content_style_->content());
object.styles[i]->serialize(content_style_->content());
}
package::content_simple_ptr content_settings_ = package::content_simple::create();
object.settings->serialize(content_settings_->content());

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_page_layout_context.h"

View File

@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include "odf_rels.h"
#include <cpdoccore/xml/attributes.h>
@ -54,11 +51,11 @@ void relationship::serialize(std::wostream & _Wostream)
}
}
void rels::serialize(std::wostream & _Wostream)
void rels::serialize(std::wostream & strm)
{
BOOST_FOREACH(relationship & r, relationship_)
for (size_t i = 0; i < relationship_.size(); i++)
{
r.serialize(_Wostream);
relationship_[i].serialize(strm);
}
}

View File

@ -40,7 +40,6 @@
#include "style_paragraph_properties.h"
#include <boost/foreach.hpp>
#include <iostream>
namespace cpdoccore {
@ -56,10 +55,10 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
{
if (result == NULL)return;
BOOST_REVERSE_FOREACH(style_paragraph_properties* v, parProps)
for (size_t i = parProps.size() - 1; i >= 0; i--)
{
if (v)
result->apply_from(v->content_);
if (parProps[i])
result->apply_from(parProps[i]->content_);
}
}
@ -93,7 +92,7 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
{
std::wstring odf_name = oox_name;
if (odf_name.length() <1)odf_name = find_free_name(family);
if (odf_name.empty()) odf_name = find_free_name(family);
office_element_ptr elm;
create_element(L"style", L"style", elm, odf_context_);

View File

@ -32,8 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_conversion_context.h"

View File

@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <iostream>

View File

@ -37,7 +37,6 @@
#include "ods_conversion_context.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
@ -139,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;
@ -183,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;

View File

@ -32,8 +32,6 @@
#include "office_annotation.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -159,9 +157,9 @@ void office_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -210,9 +208,9 @@ void officeooo_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_body.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>

View File

@ -33,10 +33,7 @@
#include "office_chart.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
@ -61,9 +58,9 @@ void office_chart::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -101,9 +98,9 @@ void chart_chart::serialize(std::wostream & _Wostream)
{
chart_chart_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -271,9 +268,9 @@ void chart_plot_area::serialize(std::wostream & _Wostream)
{
chart_plot_area_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -349,9 +346,9 @@ void chart_axis::serialize(std::wostream & _Wostream)
{
chart_axis_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -427,9 +424,9 @@ void chart_series::serialize(std::wostream & _Wostream)
{
chart_series_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -56,9 +54,9 @@ void office_settings::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -88,9 +86,9 @@ void settings_config_item_set::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -145,9 +143,9 @@ void settings_config_item_map_indexed::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -174,9 +172,9 @@ void settings_config_item_map_named::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -203,9 +201,9 @@ void settings_config_item_map_entry::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,8 +32,6 @@
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -63,9 +61,9 @@ void office_spreadsheet::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -32,10 +32,7 @@
#include "office_text.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {

View File

@ -35,7 +35,6 @@
#include <ostream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
@ -250,9 +249,9 @@ void text_span::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
if (parElement) parElement->serialize(CP_XML_STREAM());
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -547,9 +546,9 @@ void text_placeholder::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -585,12 +584,12 @@ void text_page_number::serialize(std::wostream & _Wostream)
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"text:page-adjust",text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page",text_select_page_);
CP_XML_ATTR_OPT(L"text:page-adjust", text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page", text_select_page_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -625,9 +624,9 @@ void text_page_count::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -662,9 +661,9 @@ void text_date::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -701,9 +700,9 @@ void text_time::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
CP_XML_ATTR_OPT(L"text:time-value", text_time_value_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -740,9 +739,9 @@ void text_file_name::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -776,9 +775,9 @@ void text_sequence::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -823,9 +822,9 @@ void text_sheet_name::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"

View File

@ -38,9 +38,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <boost/foreach.hpp>
#include "borderstyle.h"
namespace cpdoccore {
@ -85,9 +82,9 @@ void style_tab_stops::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, style_tab_stops_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < style_tab_stops_.size(); i++)
{
style_tab_stops_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
@ -91,9 +90,9 @@ void style_columns::serialize(std::wostream & strm)
if(style_column_sep_) style_column_sep_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, style_column_)
{
elm->serialize(CP_XML_STREAM());
for (size_t i = 0; i < style_column_.size(); i++)
{
style_column_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -37,7 +37,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
@ -543,18 +542,18 @@ void styles::add_child_element( const office_element_ptr & child, odf_conversion
}
void styles::serialize(std::wostream & strm)//content from different element
{
BOOST_FOREACH(office_element_ptr & elm, number_styles_)
{
elm->serialize(strm);
for (size_t i = 0; i < number_styles_.size(); i++)
{
number_styles_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, style_style_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, text_list_style_)
{
elm->serialize(strm);
for (size_t i = 0; i < style_style_.size(); i++)
{
style_style_[i]->serialize(strm);
}
for (size_t i = 0; i < text_list_style_.size(); i++)
{
text_list_style_[i]->serialize(strm);
}
}
void templates::create_child_element( const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
@ -576,10 +575,10 @@ void templates::add_child_element( const office_element_ptr & child)
}
void templates::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, table_templates_)
{
elm->serialize(strm);
}
for (size_t i = 0; i < table_templates_.size(); i++)
{
table_templates_[i]->serialize(strm);
}
}
void draw_styles::create_child_element(const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
@ -632,29 +631,29 @@ void draw_styles::add_child_element( const office_element_ptr & child, odf_conve
void draw_styles::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, draw_fill_image_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_fill_image_.size(); i++)
{
draw_fill_image_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_hatch_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_hatch_.size(); i++)
{
draw_hatch_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_gradient_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_opacity_)
{
elm->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_marker_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_gradient_.size(); i++)
{
draw_gradient_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_stroke_dash_)
{
elm->serialize(strm);
for (size_t i = 0; i < draw_opacity_.size(); i++)
{
draw_opacity_[i]->serialize(strm);
}
for (size_t i = 0; i < draw_marker_.size(); i++)
{
draw_marker_[i]->serialize(strm);
}
for (size_t i = 0; i < draw_stroke_dash_.size(); i++)
{
draw_stroke_dash_[i]->serialize(strm);
}
}
// office:automatic-styles
@ -696,11 +695,10 @@ void office_automatic_styles::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr elm, style_page_layout_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < style_page_layout_.size(); i++)
{
style_page_layout_[i]->serialize(CP_XML_STREAM());
}
styles_.serialize(CP_XML_STREAM());
}
}
@ -762,11 +760,10 @@ void office_master_styles::serialize(std::wostream & strm)
if (draw_layer_set_)
draw_layer_set_->serialize(CP_XML_STREAM());
BOOST_FOREACH(office_element_ptr elm, style_master_page_)
{
elm->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < style_master_page_.size(); i++)
{
style_master_page_[i]->serialize(CP_XML_STREAM());
}
if (style_handout_master_)
style_handout_master_->serialize(CP_XML_STREAM());

View File

@ -33,7 +33,6 @@
#include "table.h"
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -272,7 +271,7 @@ void table_table_columns::create_child_element(const std::wstring & Ns, const st
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -284,7 +283,7 @@ void table_table_columns::add_child_element( const office_element_ptr & child_el
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_columns::serialize(std::wostream & _Wostream)
{
@ -292,9 +291,9 @@ void table_table_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -309,7 +308,7 @@ void table_table_header_columns::create_child_element( const std::wstring & Ns,
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -321,7 +320,7 @@ void table_table_header_columns::add_child_element( const office_element_ptr & c
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_columns::serialize(std::wostream & _Wostream)
{
@ -329,9 +328,9 @@ void table_table_header_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -347,7 +346,7 @@ void table_columns::create_child_element( const std::wstring & Ns, const std::ws
}
else if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_column_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
not_applicable_element(L"table-columns", Ns, Name);
@ -367,15 +366,15 @@ void table_columns::add_child_element( const office_element_ptr & child_element)
table_table_columns_ = child_element;
}
else if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_columns::serialize(std::wostream & _Wostream)
void table_columns::serialize(std::wostream & strm)
{
if (table_table_columns_) table_table_columns_->serialize(_Wostream);
if (table_table_columns_) table_table_columns_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-columns-no-group
@ -521,11 +520,11 @@ void table_columns_and_groups::add_child_element( const office_element_ptr & chi
not_applicable_element(L"table-columns-and-groups", L"", L"");
}
}
void table_columns_and_groups::serialize(std::wostream & _Wostream)
void table_columns_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-table-cell-content
@ -539,11 +538,11 @@ void table_table_cell_content::add_child_element( const office_element_ptr & chi
{
text_content_.push_back(child_element);
}
void table_table_cell_content::serialize(std::wostream & _Wostream)
void table_table_cell_content::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
for (size_t i = 0; i < text_content_.size(); i++)
{
if (elm) elm->serialize(_Wostream);
text_content_[i]->serialize(strm);
}
}
// table:table-cell
@ -635,9 +634,9 @@ void table_table_row::serialize(std::wostream & _Wostream)
{
table_table_row_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -650,21 +649,21 @@ const wchar_t * table_table_rows::name = L"table-rows";
void table_table_rows::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
void table_table_rows::add_child_element( const office_element_ptr & child_element)
{
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_rows::serialize(std::wostream & _Wostream)
void table_table_rows::serialize(std::wostream & strm)
{
CP_XML_WRITER(_Wostream)
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(strm);
}
}
}
@ -679,7 +678,7 @@ void table_table_header_rows::create_child_element( const std::wstring & Ns, con
{
if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
@ -691,7 +690,7 @@ void table_table_header_rows::add_child_element( const office_element_ptr & chil
ElementType type = child_element->get_type();
if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_rows::serialize(std::wostream & _Wostream)
{
@ -699,9 +698,9 @@ void table_table_header_rows::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
@ -716,7 +715,7 @@ void table_rows::create_child_element(const std::wstring & Ns, const std::wstrin
}
else if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_row_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
{
@ -733,16 +732,16 @@ void table_rows::add_child_element( const office_element_ptr & child_element)
table_table_rows_ = child_element;
else if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_rows::serialize(std::wostream & _Wostream)
void table_rows::serialize(std::wostream & strm)
{
if (table_table_rows_)
table_table_rows_->serialize(_Wostream);
table_table_rows_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-rows-no-group
@ -851,11 +850,11 @@ void table_rows_and_groups::add_child_element( const office_element_ptr & child_
content_.push_back(elm);
}
}
void table_rows_and_groups::serialize(std::wostream & _Wostream)
void table_rows_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table:table-row-group
@ -911,9 +910,9 @@ void table_shapes::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}

View File

@ -186,8 +186,8 @@ public:
virtual void serialize(std::wostream & _Wostream);
public:
office_element_ptr table_table_columns_;
office_element_ptr_array table_table_column_;
office_element_ptr table_table_columns_;
office_element_ptr_array content_;
};
@ -296,7 +296,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
@ -318,7 +318,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
@ -472,7 +472,7 @@ public:
{
}
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
@ -494,7 +494,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
@ -509,7 +509,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr table_table_rows_;
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};

View File

@ -32,10 +32,7 @@
#include "text_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"
@ -76,11 +73,11 @@ void paragraph::add_text(const std::wstring & Text)
office_element_ptr elm = text_text::create(Text) ;
paragraph_content_.push_back( elm );
}
void paragraph::serialize(std::wostream & _Wostream)
void paragraph::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
{
elm->serialize(_Wostream);
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(strm);
}
}
void paragraph::serialize_attr(CP_ATTR_NODE)
@ -95,11 +92,10 @@ void paragraph_attrs::serialize(CP_ATTR_NODE)
std::wstring text_class_names_all;
BOOST_FOREACH(const std::wstring & elm, text_class_names_)
{
text_class_names_all = elm + std::wstring(L" ");
}
for (size_t i = 0; i < text_class_names_.size(); i++)
{
text_class_names_all = text_class_names_[i] + std::wstring(L" ");
}
if (!text_class_names_all.empty())
CP_XML_ATTR(L"text:class-names", text_class_names_all);
}
@ -186,9 +182,9 @@ void text_list::serialize(std::wostream & _Wostream)
if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & listItem, text_list_items_)
for (size_t i = 0; i < text_list_items_.size(); i++)
{
listItem->serialize(CP_XML_STREAM());
text_list_items_[i]->serialize(CP_XML_STREAM());
}
}
}

Some files were not shown because too many files have changed in this diff Show More