Compare commits

...

42 Commits

Author SHA1 Message Date
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
4071fa315b Added building hunspell 2017-07-26 13:22:00 +03:00
82eae7fc3e hunspell dynamic link 2017-07-26 11:18:25 +03:00
8efed345b0 fix bug #35412 2017-07-24 17:32:31 +03:00
f5dcb1bed7 Merge branch 'hotfix/v4.4.2' into develop
Conflicts:
	ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp
2017-07-24 15:46:05 +03:00
6b4695fc3a . 2017-07-24 15:06:01 +03:00
bed884007c PptxFormat - slide sections 2017-07-23 16:38:57 +03:00
1aa0b03901 XlsFormat - fix pivots after testing 2017-07-21 19:41:26 +03:00
e2ada4ca61 Merge commit '08e97b4a68950d969dce001f8e1ead84086c0244' into develop 2017-07-21 18:40:26 +03:00
d87649f08e no message 2017-07-21 18:37:34 +03:00
3982ac06d2 Merge pull request #35 from ONLYOFFICE/feature/lena_fix_2
fix not compiled
2017-07-21 17:38:16 +03:00
0a5d0af882 fix not compiled 2017-07-21 17:36:56 +03:00
08e97b4a68 Merge pull request #34 from ONLYOFFICE/feature/lenas-fixes
Feature/lenas fixes
2017-07-21 16:21:05 +03:00
c4447d7396 fix bug #35395 2017-07-21 16:12:28 +03:00
c55af15ccd . 2017-07-21 15:47:36 +03:00
333d2fdbf0 fix 2017-07-21 15:36:47 +03:00
a2bbb1640c project for mac debug 2017-07-20 17:46:38 +03:00
7388bf871f refactoring 2017-07-20 17:41:28 +03:00
493238d656 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-07-20 16:40:01 +03:00
ea8dc009c9 OdfFormatReader - pilot(pivot) tables 2017-07-20 16:39:23 +03:00
9ade820313 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  .
  fix unsize shape text rect
  XlsFormat - pivot charts
  fix bug #35396. version up.
  .
  OdfFormatWriter - data label position XlsFormatReader - fix pivots
2017-07-20 16:38:41 +03:00
358c1613ad fix bug #35395 2017-07-20 16:38:30 +03:00
b3a83ad699 . 2017-07-20 13:28:58 +03:00
8d4e78ed40 fix unsize shape text rect 2017-07-20 13:28:52 +03:00
bde2c73f64 XlsFormat - pivot charts 2017-07-20 11:14:47 +03:00
66fe9e6447 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-19 12:25:21 +03:00
f6d745cd25 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-20 11:21:03 +03:00
002d30454c fix bug #35396. version up. 2017-07-20 11:19:07 +03:00
ae2e9a5f26 . 2017-07-19 12:22:58 +03:00
143 changed files with 5198 additions and 904 deletions

View File

@ -2087,6 +2087,7 @@ namespace DocFileFormat
nElemSize = 4;
bTruncated = true;
}
else nElemSize = 2;
long dwSize = nElems * nElemSize;

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

@ -3039,6 +3039,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));

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
{
@ -715,7 +716,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

@ -7222,6 +7222,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 +7719,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()

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

@ -105,6 +105,7 @@ SOURCES += \
../src/odf/table_calculation_settings.cpp \
../src/odf/table_docx.cpp \
../src/odf/table_named_expressions.cpp \
../src/odf/table_data_pilot_tables.cpp \
../src/odf/table_pptx.cpp \
../src/odf/table_xlsx.cpp \
../src/odf/templates.cpp \
@ -210,6 +211,12 @@ SOURCES += \
../src/odf/datatypes/writingmode.cpp \
../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 \
@ -279,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
}
@ -463,6 +471,8 @@ HEADERS += \
../src/odf/datatypes/wrapoption.h \
../src/odf/datatypes/writingmode.h \
../src/odf/datatypes/xlink.h \
../src/odf/datatypes/chartlabelposition.h \
../src/odf/datatypes/grandtotal.h \
../src/docx/docx_content_type.h \
../src/docx/docx_conversion_context.h \
../src/docx/docx_conversion_state.h \

View File

@ -88,6 +88,7 @@
#include "../src/odf/table_calculation_settings.cpp"
#include "../src/odf/table_docx.cpp"
#include "../src/odf/table_named_expressions.cpp"
#include "../src/odf/table_data_pilot_tables.cpp"
#include "../src/odf/table_pptx.cpp"
#include "../src/odf/table_xlsx.cpp"
#include "../src/odf/templates.cpp"

View File

@ -120,3 +120,9 @@
#include "../src/odf/datatypes/writingmode.cpp"
#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>
@ -82,8 +80,25 @@ void xlsx_document::write(const std::wstring & 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 +116,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 +136,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 +176,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 +201,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 +264,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 +301,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 +408,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 +438,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 +453,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 +468,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,240 @@
/*
* (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_cache
{
std::wstring definitionsData_;
std::wstring recordsData_;
};
struct _pivot_view
{
std::wstring data_;
int indexCache_;
};
struct _pivot_field
{
std::wstring view_;
std::wstring cache_;
};
Impl() {}
std::vector<_pivot_cache> caches_;
std::vector<_pivot_view> views_;
std::wstring connections_;
std::vector<_pivot_field> fields_;
std::wstringstream view_;
std::wstringstream cache_;
};
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
{
}
void xlsx_pivots_context::add_cache(std::wstring definitions, std::wstring records)
{
Impl::_pivot_cache c = {definitions, records};
impl_->caches_.push_back(c);
}
int xlsx_pivots_context::get_cache_count()
{
return (int)impl_->caches_.size();
}
bool xlsx_pivots_context::is_connections()
{
return !impl_->connections_.empty();
}
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
{
if (impl_->caches_[index].recordsData_.empty() == false)
{
Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
}
}
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
{
if (impl_->views_[index].indexCache_ >= 0)
{
Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(impl_->views_[index].indexCache_ + 1) + L".xml", L""));
}
}
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
{
strm << impl_->caches_[index].definitionsData_;
}
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"connections")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_STREAM() << impl_->connections_;
}
}
}
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
{
strm << impl_->caches_[index].recordsData_;
}
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
{
strm << impl_->views_[index].data_;
}
void xlsx_pivots_context::start_table()
{
impl_->fields_.clear();
}
int xlsx_pivots_context::end_table()
{
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotTableDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
//CP_XML_ATTR(L"name", view->stTable.value());
//CP_XML_ATTR(L"cacheId", view->iCache);
//CP_XML_ATTR(L"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", view->ref.toString());
//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", impl_->fields_.size());
for (size_t i = 0; i < impl_->fields_.size(); i++)
{
impl_->fields_[i].view_;
}
}
}
}
Impl::_pivot_view v = {strm.str(), impl_->views_.size() + 1};
impl_->views_.push_back(v);
return impl_->views_.size();
}
void xlsx_pivots_context::start_field()
{
}
void xlsx_pivots_context::end_field()
{
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotField")
{
}
}
Impl::_pivot_field f = {strm.str(), L""};
impl_->fields_.push_back(f);
}
void xlsx_pivots_context::add_connections(std::wstring connections)
{
if (connections.empty()) return;
impl_->connections_ = connections;
}
int xlsx_pivots_context::get_view_count()
{
return (int)impl_->views_.size();
}
xlsx_pivots_context::~xlsx_pivots_context()
{
}
std::wostream & xlsx_pivots_context::stream_view()
{
return impl_->view_;
}
std::wostream & xlsx_pivots_context::stream_cache()
{
return impl_->cache_;
}
}
}

View File

@ -0,0 +1,83 @@
/*
* (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 end_field();
//int add_view(int indexCache);
int get_view_count();
void add_cache(std::wstring definitions, std::wstring records);
int get_cache_count();
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();
std::wostream & stream_view();
std::wostream & stream_cache();
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}
}

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_cache_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_view_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()) );
}
}
}
@ -381,9 +428,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"
@ -168,6 +169,7 @@ public:
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 +204,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,66 @@
/*
* (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 "grandtotal.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const grand_total & _Val)
{
switch(_Val.get_type())
{
case grand_total::none: _Wostream << L"none"; break;
case grand_total::both: _Wostream << L"both"; break;
case grand_total::column: _Wostream << L"column"; break;
case grand_total::row: _Wostream << L"row"; break;
}
return _Wostream;
}
grand_total grand_total::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"none") return grand_total( none );
else if (tmp == L"both") return grand_total( both );
else if (tmp == L"column") return grand_total( column );
else if (tmp == L"row") return grand_total( row );
else
{
return grand_total( none );
}
}
} }

View File

@ -0,0 +1,67 @@
/*
* (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 grand_total
{
public:
enum type
{
none,
both,
column,
row
};
grand_total() {}
grand_total(type _Type) : type_(_Type) {}
type get_type() const { return type_; };
static grand_total parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const grand_total & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::grand_total);
}

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,
@ -219,6 +225,27 @@ enum ElementType
typeTableTableRowGroup,
typeTableTableRowNoGroup,
typeTableTableSource,
typeTableDataPilotTables,
typeTableDataPilotTable,
typeTableDataPilotField,
typeTableDataPilotFieldReference,
typeTableDatabaseSourceTable,
typeTableDatabaseSourceQuery,
typeTableDatabaseSourceSql,
typeTableSourceCellRange,
typeTableSourceService,
typeTableDataPilotSubtotals,
typeTableDataPilotSubtotal,
typeTableDataPilotGroupMember,
typeTableDataPilotMember,
typeTableDataPilotMembers,
typeTableDataPilotGroup,
typeTableDataPilotGroups,
typeTableDataPilotLevel,
typeTableDataSortInfo,
typeTableDataDisplayInfo,
typeTableDataLayoutInfo,
typeOfficeBody,
typeOfficeText,

View File

@ -34,7 +34,6 @@
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
@ -49,22 +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(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();
@ -78,17 +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);
}
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,26 +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 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_);
}
@ -376,18 +376,18 @@ 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)
@ -402,18 +402,18 @@ 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)
@ -432,7 +432,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)
@ -519,6 +519,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 +597,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

@ -35,11 +35,13 @@
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "table_named_expressions.h"
#include "table_database_ranges.h"
#include "table_data_pilot_tables.h"
#include "calcext_elements.h"
#include "datatypes/tablemode.h"
@ -49,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_;
@ -74,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_;
@ -88,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_;
@ -102,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
@ -122,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_;
@ -149,7 +138,6 @@ public:
};
// table:table-source
class table_table_source : public office_element_impl<table_table_source>
{
public:
@ -170,7 +158,6 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table:columns
class table_columns
{
public:
@ -180,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:
@ -202,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);
@ -212,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:
@ -232,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
@ -254,7 +232,6 @@ public:
};
// table:table-column
class table_table_column : public office_element_impl<table_table_column>
{
public:
@ -277,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:
@ -302,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:
@ -329,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:
@ -370,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:
@ -388,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:
@ -396,14 +361,12 @@ 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_;
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:
@ -415,13 +378,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:
@ -438,7 +399,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:
@ -449,15 +409,14 @@ private:
public:
bool last_cell_;
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:
@ -474,7 +433,6 @@ public:
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,14 +445,13 @@ public:
bool last_cell_;
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:
@ -512,7 +469,6 @@ public:
table_table_rows()
{
}
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -523,10 +479,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:
@ -541,7 +495,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:
@ -553,10 +506,8 @@ public:
office_element_ptr_array table_table_row_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// table:rows
class table_rows
{
public:
@ -567,13 +518,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:
@ -591,8 +541,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);
@ -600,7 +550,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_;
@ -609,21 +558,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_;
@ -631,7 +577,6 @@ public:
};
// table:table-row-group-attlist
class table_table_row_group_attlist
{
public:
@ -641,7 +586,6 @@ public:
};
// table:table-row-group
class table_table_row_group : public office_element_impl<table_table_row_group>
{
public:
@ -667,10 +611,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:
@ -705,10 +647,8 @@ public:
//table-scenario
//office-forms
};
CP_REGISTER_OFFICE_ELEMENT2(table_table);
// table:shapes
class table_shapes : public office_element_impl<table_shapes>
{
public:
@ -730,7 +670,6 @@ private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_shapes);
}

View File

@ -0,0 +1,413 @@
/*
* (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 "table_data_pilot_tables.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
namespace cpdoccore {
using namespace odf_types;
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_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)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_data_pilot_table::ns = L"table";
const wchar_t * table_data_pilot_table::name = L"data-pilot-table";
void table_data_pilot_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:name" , table_name_);
CP_APPLY_ATTR(L"table:application-data" , table_application_data_);
CP_APPLY_ATTR(L"table:buttons" , table_buttons_);
CP_APPLY_ATTR(L"table:drill-down-ondouble-click", table_drill_down_ondouble_click_);
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-filter-button" , table_show_filter_button_);
CP_APPLY_ATTR(L"table:show-target-range-address", table_show_target_range_address_);
}
void table_data_pilot_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
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)
{
if (!source_) return;
Context.get_pivots_context().start_table();
source_->xlsx_convert(Context);
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().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";
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_);
}
void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_pivots_context().start_field();
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->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";
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::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_query::ns = L"table";
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::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_sql::ns = L"table";
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::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_source_cell_range::ns = L"table";
const wchar_t * table_source_cell_range::name = L"source-cell-range";
void table_source_cell_range::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:cellrange-address", table_cellrange_address_);
}
void table_source_cell_range::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
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);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_source_service::ns = L"table";
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::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)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_level::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
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_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

@ -0,0 +1,517 @@
/*
* (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 <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#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 {
class table_data_pilot_tables : public office_element_impl<table_data_pilot_tables>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotTables;
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);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_tables);
//-------------------------------------------------------------------------------------
class table_data_pilot_table : public office_element_impl<table_data_pilot_table>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotTable;
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);
_CP_OPT(std::wstring) table_name_;
_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_filter_button_;
_CP_OPT(odf_types::Bool) table_show_target_range_address_;
office_element_ptr source_;
office_element_ptr_array fields_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_table);
//-------------------------------------------------------------------------------------
class table_data_pilot_field : public office_element_impl<table_data_pilot_field>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDataPilotField;
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);
_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_array content_;
};
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){}
_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>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDatabaseSourceTable;
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){}
_CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_database_table_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_source_table);
//-------------------------------------------------------------------------------------
class table_database_source_query : public office_element_impl<table_database_source_query>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDatabaseSourceQuery;
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){}
_CP_OPT(std::wstring) table_database_name_;
_CP_OPT(std::wstring) table_query_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_source_query);
//-------------------------------------------------------------------------------------
class table_database_source_sql : public office_element_impl<table_database_source_sql>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableDatabaseSourceSql;
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){}
_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);
//-------------------------------------------------------------------------------------
class table_source_cell_range : public office_element_impl<table_source_cell_range>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableSourceCellRange;
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);
_CP_OPT(std::wstring) table_cellrange_address_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_source_cell_range);
//-------------------------------------------------------------------------------------
class table_source_service : public office_element_impl<table_source_service>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableSourceService;
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){}
_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);
_CP_OPT(odf_types::Bool) table_show_empty_;
office_element_ptr_array content_;
};
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);
_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);
_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);
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){}
_CP_OPT(odf_types::Bool) table_display_;
_CP_OPT(std::wstring) table_name_;
_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){}
_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);
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){}
_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){}
_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){}
_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){}
_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

@ -82,8 +82,8 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
///обработка чтилей для роу -
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 +140,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 +214,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,16 +259,16 @@ 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->attlist_.table_number_rows_repeated_ > 1000 &&
row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
{
std::wstring style = row_last->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"");
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->table_table_row_attlist_.table_number_rows_repeated_ = 1024;
row_last_1->attlist_.table_number_rows_repeated_ = 1024;
table_table_row_.pop_back();
}
}
@ -301,11 +301,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 +328,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 +628,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 +647,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 +781,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 +801,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 +834,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 +875,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 +896,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

@ -565,6 +565,14 @@
RelativePath="..\src\odf\datatypes\gradientstyle.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\grandtotal.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\grandtotal.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\hatchstyle.cpp"
>
@ -689,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"
>
@ -901,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"
>
@ -909,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

@ -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"
>
@ -1659,6 +1667,14 @@
RelativePath="..\src\odf\table_calculation_settings.h"
>
</File>
<File
RelativePath="..\src\odf\table_data_pilot_tables.cpp"
>
</File>
<File
RelativePath="..\src\odf\table_data_pilot_tables.h"
>
</File>
<File
RelativePath="..\src\odf\table_database_ranges.cpp"
>
@ -1687,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

@ -594,8 +594,17 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(oox_spPr->xfrm.GetPointer());
PPTX::Logic::PrstGeom* prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
PPTX::Logic::CustGeom* custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
PPTX::Logic::PrstGeom* prstGeom = NULL;
PPTX::Logic::CustGeom* custGeom = NULL;
if (oox_spPr->Geometry.is<PPTX::Logic::PrstGeom>())
{
prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
}
if (oox_spPr->Geometry.is<PPTX::Logic::CustGeom>())
{
custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
}
convert(prstGeom);
convert(custGeom);
@ -627,8 +636,13 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
}
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
PPTX::Logic::EffectLst* effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
PPTX::Logic::EffectLst* effectLst = NULL;
if (oox_spPr->EffectList.is<PPTX::Logic::EffectLst>())
{
effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
}
if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
@ -642,20 +656,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
{
if (oox_fill == NULL) return;
PPTX::Logic::NoFill* noFill = &oox_fill->as<PPTX::Logic::NoFill>();
PPTX::Logic::BlipFill* blipFill = &oox_fill->as<PPTX::Logic::BlipFill>();
PPTX::Logic::GradFill* gradFill = &oox_fill->as<PPTX::Logic::GradFill>();
PPTX::Logic::SolidFill* solidFill = &oox_fill->as<PPTX::Logic::SolidFill>();
PPTX::Logic::PattFill* pattFill = &oox_fill->as<PPTX::Logic::PattFill>();
if (oox_fill == NULL) return;
if (solidFill) convert(solidFill, nARGB);
else if (blipFill) convert(blipFill);
else if (gradFill) convert(gradFill, nARGB);
else if (pattFill) convert(pattFill, nARGB);
else if (noFill) odf_context()->drawing_context()->set_no_fill();
if (oox_fill->is<PPTX::Logic::NoFill>()) odf_context()->drawing_context()->set_no_fill();
if (oox_fill->is<PPTX::Logic::BlipFill>()) convert(&oox_fill->as<PPTX::Logic::BlipFill>());
if (oox_fill->is<PPTX::Logic::GradFill>()) convert(&oox_fill->as<PPTX::Logic::GradFill>(), nARGB);
if (oox_fill->is<PPTX::Logic::SolidFill>()) convert(&oox_fill->as<PPTX::Logic::SolidFill>(),nARGB);
if (oox_fill->is<PPTX::Logic::PattFill>()) convert(&oox_fill->as<PPTX::Logic::PattFill>(), nARGB);
}
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
@ -783,8 +791,10 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
for (size_t i = 0 ; i < oox_geom_path->Paths.size(); i++)
{
PPTX::Logic::PathBase* pathBase = &oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>();
convert(pathBase);
if (oox_geom_path->Paths[i].Path2D.is<PPTX::Logic::PathBase>())
{
convert(&oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>());
}
}
if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false)
@ -1692,12 +1702,21 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
_CP_OPT(double) opacityText;
std::wstring hexColorText;
PPTX::Logic::GradFill* gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
PPTX::Logic::GradFill* gradFill = NULL;
PPTX::Logic::SolidFill* solidFill = NULL;
if (oox_run_pr->Fill.is<PPTX::Logic::GradFill>())
{
gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
}
if (gradFill && !gradFill->GsLst.empty())
{
convert(&gradFill->GsLst[0].color, hexColorText, opacityText);
}
PPTX::Logic::SolidFill* solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
if (oox_run_pr->Fill.is<PPTX::Logic::SolidFill>())
{
solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
}
if (solidFill)
{
convert(&solidFill->Color, hexColorText, opacityText);

View File

@ -449,25 +449,21 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
PPTX::Theme* old_theme = current_theme;
PPTX::Logic::ClrMap* old_clrMap = current_clrMap;
smart_ptr<PPTX::NotesMaster> notes_master;
if (!presentation->notesMasterIdLst.empty())
{
std::wstring rId = presentation->notesMasterIdLst[0].rid.get();
notes_master = ((*presentation)[rId]).smart_dynamic_cast<PPTX::NotesMaster>();
}
odp_context->start_note();
if (notes_master.IsInit())
if (oox_notes->master_.IsInit())
{
current_theme = notes_master->theme_.operator->();
current_clrMap = &notes_master->clrMap;
current_theme = oox_notes->master_->theme_.operator->();
current_clrMap = &oox_notes->master_->clrMap;
}
current_slide = dynamic_cast<OOX::IFileContainer*>(oox_notes);
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
{
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
}
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include "../../../DesktopEditor/common/ASCVariant.h"
#include "../../DesktopEditor/common/ASCVariant.h"
#include <vector>

View File

@ -4581,10 +4581,13 @@ std::wstring CDrawingConverter::SaveObjectBackground(LONG lStart, LONG lLength)
NSBinPptxRW::CXmlWriter oXmlWriter;
SaveObjectExWriterInit(oXmlWriter, XMLWRITER_DOC_TYPE_DOCX);
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
if (oElem.is<PPTX::Logic::Shape>())
{
oXmlWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVMLBackground(&oXmlWriter, *m_pTheme, *m_pClrMap);
}
--m_nCurrentIndexObject;
SaveObjectExWriterRelease(oXmlWriter);
@ -4606,18 +4609,26 @@ void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const st
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
if (oElem.is<PPTX::Logic::Shape>())
{
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
}
}
void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
if (oElem.is<PPTX::Logic::SpTree>())
{
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе (вместе с остальными параметрами)
PPTX::Logic::SpTree& oGroup = oElem.as<PPTX::Logic::SpTree>();
oGroup.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
}
}
void CDrawingConverter::ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape)
{

View File

@ -61,6 +61,7 @@ private:
std::wstring m_strEmbeddedFontsDirectory;
std::wstring m_strFolderThemes;
bool m_bIsNoBase64;
extract_to_directory m_fCallbackExtract;
compress_from_directory m_fCallbackCompress;
@ -93,6 +94,7 @@ public:
HRESULT SetFontDir (std::wstring bsFontDir);
HRESULT SetThemesDir (std::wstring bsDir);
HRESULT SetUseSystemFonts (bool useSystemFonts);
void SetIsNoBase64 (bool bIsNoBase64);
HRESULT OpenFileToPPTY (std::wstring bsInput, std::wstring bsOutput);
HRESULT OpenDirectoryToPPTY (std::wstring bsInput, std::wstring bsOutput);
HRESULT ConvertPPTYToPPTX (std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder);

View File

@ -67,6 +67,7 @@ CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_direct
m_strEmbeddedFontsDirectory = _T("");
m_strFolderThemes = _T("");
m_bIsNoBase64 = false;
//m_fCallbackResource = fCallbackResource;
m_fCallbackExtract = fCallbackExtract;
@ -232,6 +233,10 @@ HRESULT CPPTXFile::SetUseSystemFonts(bool val)
m_bIsUseSystemFonts = val;
return S_OK;
}
void CPPTXFile::SetIsNoBase64(bool bIsNoBase64)
{
m_bIsNoBase64 = bIsNoBase64;
}
HRESULT CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput)
{
if (m_strTempDir.empty())
@ -325,7 +330,7 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutp
}
}
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, pathDstFileOutput.GetPath());
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, pathDstFileOutput.GetPath(), m_bIsNoBase64);
return S_OK;
}
@ -360,7 +365,7 @@ HRESULT CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput
std::wstring strBsInput = bsInput;
std::wstring srcFolder = NSDirectory::GetFolderPath(strBsInput);
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
RELEASEARRAYOBJECTS(pSrcBuffer);
HRESULT hRes = S_OK;

View File

@ -42,6 +42,8 @@ namespace NSBinPptxRW
const BYTE g_nodeAttributeStart = 0xFA;
const BYTE g_nodeAttributeEnd = 0xFB;
const int g_nFormatVersionNoBase64 = 10;
namespace NSSerFormat
{
enum SerFormat

View File

@ -790,6 +790,17 @@ namespace NSBinPptxRW
{
_WriteString(sBuffer.c_str(), (_UINT32)sBuffer.length());
}
void CBinaryFileWriter::WriteStringUtf8(const std::wstring& sBuffer)
{
BYTE* pData = NULL;
LONG lLen = 0;
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sBuffer.c_str(), (LONG)sBuffer.length(), pData, lLen, false);
WriteBYTEArray(pData, lLen);
RELEASEARRAYOBJECTS(pData);
}
CBinaryFileWriter::CBinaryFileWriter()
{
m_pMainDocument = NULL;
@ -844,9 +855,9 @@ namespace NSBinPptxRW
m_lPosition += (_UINT32)lCount;
}
void CBinaryFileWriter::WriteMainPart()
void CBinaryFileWriter::WriteMainPart(_UINT32 nStartPos)
{
BYTE* pData = m_pStreamData;
BYTE* pData = m_pStreamData + nStartPos;
size_t nCount = m_arMainTables.size();
for (size_t i = 0; i < nCount; i++)

View File

@ -292,6 +292,7 @@ namespace NSBinPptxRW
void WriteStringW3 (const std::wstring& sBuffer);
void WriteStringW4 (const std::wstring& sBuffer);
void WriteStringUtf8(const std::wstring& sBuffer);
// --------------------------------------------------------
void WriteLONG64 (const _INT64& lValue);
void WriteDouble64 (const double& dValue);
@ -306,7 +307,7 @@ namespace NSBinPptxRW
void StartMainRecord(_INT32 lType);
void WriteReserved(size_t lCount);
void WriteMainPart();
void WriteMainPart(_UINT32 nStartPos);
void WriteString1 (int type, const std::wstring& val);
void WriteString2 (int type, const NSCommon::nullable_string& val);

View File

@ -38,7 +38,7 @@ namespace PPTX2EditorAdvanced
{
using namespace NSBinPptxRW;
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile)
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const std::wstring& strSourceDirectory, const std::wstring& strDstFile, bool bIsNoBase64)
{
// сначала соберем все объекты для конвертации и сформируем main-таблицы
NSBinPptxRW::CCommonWriter* pCommon = oBinaryWriter.m_pCommon;
@ -230,6 +230,12 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.m_pCommon->m_oNote_Rels.push_back(nMasterIndex);
}
if (bIsNoBase64)
{
std::wstring strPrefix = L"PPTY;v"+std::to_wstring(g_nFormatVersionNoBase64)+L";0;";
oBinaryWriter.WriteStringUtf8(strPrefix);
}
_UINT32 nStartPos = oBinaryWriter.GetPosition();
// нужно записать все в maintables. А кроме главных таблиц ничего и нету. Все остальное лежит в них
// на каждую таблицу - 5 байт (тип и сдвиг)
// число таблиц - заранее известно (сделаем 30. если потом не будет хватать - новая версия формата)
@ -516,29 +522,35 @@ namespace PPTX2EditorAdvanced
// ------------------------------------------------
oBinaryWriter.WriteEmbeddedFonts();
oBinaryWriter.WriteMainPart();
oBinaryWriter.WriteMainPart(nStartPos);
// все записалось нормально. осталось скинуть на диск
BYTE* pbBinBuffer = oBinaryWriter.GetBuffer();
int nBinBufferLen = (int)oBinaryWriter.GetPosition();
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
if (true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
{
CFile oFile;
#if defined(_WIN32) || defined (_WIN64)
oFile.CreateFileW(strDstFile);
#else
oFile.CreateFile(strDstFile);
#endif
std::string strPrefix = "PPTY;v1;" + std::to_string(nBinBufferLen) + ";";
oFile.WriteFile((void*)strPrefix.c_str(), (DWORD)strPrefix.length());
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
if (bIsNoBase64)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(strDstFile);
oFile.WriteFile(pbBinBuffer, nBinBufferLen);
oFile.CloseFile();
}
else
{
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen+64];
// if (true == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
if (true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(strDstFile);
std::wstring strPrefix = L"PPTY;v1;" + std::to_wstring(nBinBufferLen) + L";";
oFile.WriteStringUTF8(strPrefix);
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
oFile.CloseFile();
}
RELEASEARRAYOBJECTS(pbBase64Buffer);
RELEASEARRAYOBJECTS(pbBase64Buffer);
}
return 0;
}
}

View File

@ -118,7 +118,7 @@ namespace NSBinPptxRW
m_oReader.m_strFolderThemes = pathTheme.GetPath();
}
void OpenPPTY(BYTE* pBuffer, int len, std::wstring srcFolder, std::wstring strThemesFolder)
void OpenPPTY(BYTE* pBuffer, int len, std::wstring srcFolder, std::wstring strThemesFolder)
{
int start_pos = 0;
@ -158,11 +158,30 @@ namespace NSBinPptxRW
int dstLenTemp = XmlUtils::GetInteger(__str_decode_len);
//int dstLenTemp = Base64DecodeGetRequiredLength(len);
BYTE* pDstBuffer = new BYTE[dstLenTemp];
int dstLen = dstLenTemp;
Base64::Base64Decode((const char*)pBuffer, len, pDstBuffer, &dstLen);
int nVersion = 1;
if(__str_version.length() > 1)
{
nVersion = std::stoi(__str_version.substr(1).c_str());
}
bool bIsNoBase64 = nVersion == g_nFormatVersionNoBase64;
BYTE* pDstBuffer = NULL;
int dstLen = 0;
if(!bIsNoBase64)
{
BYTE* pDstBuffer = new BYTE[dstLenTemp];
int dstLen = dstLenTemp;
Base64::Base64Decode((const char*)pBuffer, len, pDstBuffer, &dstLen);
m_oReader.Init(pDstBuffer, 0, dstLen);
}
else
{
pDstBuffer = pBuffer - start_pos;
dstLen = len + start_pos;
m_oReader.Init(pDstBuffer, 0, dstLen);
m_oReader.Seek(start_pos);
}
m_oReader.Init(pDstBuffer, 0, dstLen);
m_oReader.m_strFolder = srcFolder;
m_oReader.m_strFolderExternalThemes = strThemesFolder;
@ -415,11 +434,10 @@ namespace NSBinPptxRW
LONG lLayouts = (LONG)m_arSlideMasters_Theme[i].m_arLayouts.size();
for (LONG j = 0; j < lLayouts; ++j)
{
arrLays.push_back(PPTX::Logic::XmlId());
arrLays.push_back(PPTX::Logic::XmlId(L"p:sldLayoutId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + __nCountLayouts + j + 1));
arrLays[j].m_name = _T("sldLayoutId");
arrLays[j].id = sId;
arrLays[j].rid = (size_t)(j + 1);
}
@ -755,11 +773,10 @@ namespace NSBinPptxRW
LONG nCountLayouts = 0;
for (LONG i = 0; i < nCountMasters; ++i)
{
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:sldMasterId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + nCountLayouts));
m_oPresentation.sldMasterIdLst[i].m_name = _T("sldMasterId");
m_oPresentation.sldMasterIdLst[i].id = sId;
m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1);
nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1);
@ -773,11 +790,10 @@ namespace NSBinPptxRW
m_oPresentation.sldIdLst.clear();
for (LONG i = 0; i < nCountSlides; ++i)
{
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId(L"p:sldId"));
std::wstring sId = std::to_wstring(256 + i);
m_oPresentation.sldIdLst[i].m_name = _T("sldId");
m_oPresentation.sldIdLst[i].id = sId;
m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels;
++nCurrentRels;
@ -788,8 +804,8 @@ namespace NSBinPptxRW
m_oPresentation.notesMasterIdLst.clear();
if (bNotesMasterPresent)
{
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId());
m_oPresentation.notesMasterIdLst[0].m_name = _T("notesMasterId");
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:notesMasterId"));
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
++nCurrentRels;
}
@ -816,8 +832,10 @@ namespace NSBinPptxRW
bIsAuthors = true;
}
}
RELEASEARRAYOBJECTS(pDstBuffer);
if(!bIsNoBase64)
{
RELEASEARRAYOBJECTS(pDstBuffer);
}
// content types
OOX::CContentTypes *pContentTypes = m_oImageManager.m_pContentTypes;

View File

@ -98,7 +98,10 @@ namespace PPTX
bool bIsSlide = false;
OOX::File* pSrcFile = dynamic_cast<OOX::File*>(this);
if (NULL != pSrcFile)
bIsSlide = (pSrcFile->type() == OOX::Presentation::FileTypes::Slide) ? true : false;
{
bIsSlide = (pSrcFile->type() == OOX::Presentation::FileTypes::Slide ||
pSrcFile->type() == OOX::Presentation::FileTypes::NotesSlide) ? true : false;
}
size_t nCount = rels.m_arrRelations.size();

View File

@ -102,7 +102,6 @@ namespace PPTX
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
const OOX::FileType& curType = pPair->second->type();
@ -128,7 +127,6 @@ namespace PPTX
}
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
const OOX::FileType& curType = pPair->second->type();
@ -141,6 +139,18 @@ namespace PPTX
}
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
{
const OOX::FileType& curType = pPair->second->type();
if (OOX::Presentation::FileTypes::NotesSlide == curType)
{
smart_ptr<PPTX::NotesSlide> pointer = pPair->second.smart_dynamic_cast<PPTX::NotesSlide>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
if (Event)
Event->Progress(0, 1000000);
}

View File

@ -32,15 +32,15 @@
#ifndef PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
#include "../Presentation/SectionLst.h"
//--------------------------------------------------------------------------------------------------------------
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
//<p14:trim st="93333.0816" end="96583.4816"/>
//</p14:media>
//</p:ext>
//--------------------------------------------------------------------------------------------------------------
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
// <x14:sparklineGroup displayEmptyCellsAs="gap">
@ -61,10 +61,33 @@
// </x14:sparklineGroup>
// </x14:sparklineGroups>
//</ext>
//--------------------------------------------------------------------------------------------------------------
//<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}">
// <a14:compatExt spid="_x0000_s1025"/>
//</a:ext>
//--------------------------------------------------------------------------------------------------------------
// <p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">
// <p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">
// <p14:section name="123" id="{775558AA-D529-4C59-9762-B6F3CDAC8092}">
// <p14:sldIdLst>
// <p14:sldId id="256"/>
// <p14:sldId id="257"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="qwerty" id="{296A3C58-7D47-4848-A546-3C86980BE927}">
// <p14:sldIdLst>
// <p14:sldId id="258"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="Раздел без заголовка" id="{DA908BF8-2A15-4E46-B49B-C1BB4B4AAF31}">
// <p14:sldIdLst/>
// </p14:section>
// </p14:sectionLst>
// </p:ext>
// <p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}">
// <p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/>
// </p:ext>
//</p:extLst>
namespace PPTX
{
@ -115,48 +138,61 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("uri"), uri)
WritingElement_ReadAttributes_ReadSingle ( oReader, L"uri", uri)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_ReadSingle( oReader, L"r:embed", link)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
WritingElement_ReadAttributes_Read_if ( oReader, L"st", st)
WritingElement_ReadAttributes_Read_else_if ( oReader, L"end", end)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid)
WritingElement_ReadAttributes_Start( oReader );
WritingElement_ReadAttributes_ReadSingle ( oReader, L"spid", spid)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{//todooo списком ..
XmlUtils::CXmlNode media = node.ReadNodeNoNS(_T("media"));
if (media.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(L"*", oNodes))
{
link = media.GetAttribute(_T("r:embed"));
XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
if (trim.IsValid())
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
trim.ReadAttributeBase(_T("st"), st);
trim.ReadAttributeBase(_T("end"), end);
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"media" == strName)
{
link = oNode.GetAttribute(L"r:embed");
XmlUtils::CXmlNode trim = oNode.ReadNodeNoNS(L"trim");
if (trim.IsValid())
{
trim.ReadAttributeBase(L"st", st);
trim.ReadAttributeBase(L"end", end);
}
}
else if (L"compatExt" == strName)
{
spid = oNode.GetAttribute(L"spid");
}
else if (L"sectionLst" == strName)
{
sectionLst = oNode;
}
}
return;
}
XmlUtils::CXmlNode compatExt = node.ReadNodeNoNS(_T("compatExt"));
if (compatExt.IsValid())
{
spid = media.GetAttribute(_T("spid"));
return;
}
}
@ -170,11 +206,11 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
if (link.IsInit() && uri.IsInit())
if (link.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", *uri);
pWriter->WriteAttribute(L"uri", std::wstring(L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"));
pWriter->EndAttributes();
pWriter->StartNode(L"p14:media");
@ -185,6 +221,16 @@ namespace PPTX
pWriter->EndNode(L"p14:media");
pWriter->EndNode(L"p:ext");
}
if (sectionLst.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", std::wstring(L"{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"));
pWriter->EndAttributes();
sectionLst->toXmlWriter(pWriter);
pWriter->EndNode(L"p:ext");
}
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
@ -201,10 +247,11 @@ namespace PPTX
//media
nullable<OOX::RId> link;
nullable_double st;
nullable_double end;
nullable_double end;
//compatExt
nullable_string spid;
nullable<nsPresentation::SectionLst> sectionLst;
//dataModelExt
//table
//sparklineGroups

View File

@ -896,7 +896,6 @@ namespace PPTX
{
PPTX::Logic::Ext ext;
ext.link = OOX::RId(blipFill.blip->mediaRid);
ext.uri = L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}";
nvPicPr.nvPr.extLst.push_back(ext);
int nRId = -1;

View File

@ -469,9 +469,17 @@ namespace PPTX
if ((nvSpPr.nvPr.ph->type.IsInit()) || (nvSpPr.nvPr.ph->idx.IsInit()))
{
if (parentFileIs<Slide>())
{
parentFileAs<Slide>().Layout->GetLevelUp(this);
}
else if(parentFileIs<SlideLayout>())
{
parentFileAs<SlideLayout>().Master->GetLevelUp(this);
}
else if(parentFileIs<NotesSlide>())
{
parentFileAs<NotesSlide>().master_->GetLevelUp(this);
}
}
}
}

View File

@ -45,9 +45,14 @@ namespace PPTX
public:
PPTX_LOGIC_BASE(XmlId)
XmlId(std::wstring name)
{
m_name = name;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = XmlUtils::GetNameNoNS(node.GetName());
m_name = node.GetName();
node.ReadAttributeBase(L"r:id", rid);
node.ReadAttributeBase(L"id", id);
}
@ -57,7 +62,7 @@ namespace PPTX
oAttr.Write(_T("r:id"), rid.ToString());
oAttr.Write(_T("id"), id);
return XmlUtils::CreateNode(_T("p:") + m_name, oAttr);
return XmlUtils::CreateNode(m_name, oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
@ -69,17 +74,48 @@ namespace PPTX
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetString2();
break;
case 1:
rid = pReader->GetString2();
break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:") + m_name);
pWriter->StartNode( m_name );
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), id);
pWriter->WriteAttribute(_T("r:id"), rid.ToString());
pWriter->WriteAttribute(_T("id"), id);
std::wstring sRid = rid.ToString();
if (sRid.empty() == false)
{
pWriter->WriteAttribute(_T("r:id"), sRid);
}
pWriter->EndAttributes();
pWriter->EndNode(_T("p:") + m_name);
pWriter->EndNode( m_name );
}
nullable_string id;

View File

@ -52,40 +52,42 @@ namespace PPTX
class Namespaces
{
public:
Namespaces() : a(L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
b(L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cdr(L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
cp(L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc(L"dc", L"http://purl.org/dc/elements/1.1/"),
Namespaces() :
a (L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
b (L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cdr (L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
cp (L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc (L"dc", L"http://purl.org/dc/elements/1.1/"),
dchrt(L"dchrt", L"http://schemas.openxmlformats.org/drawingml/2006/chart"),
dcmitype(L"dcmitype", L"http://purl.org/dc/dcmitype/"),
dcterms(L"dcterms", L"http://purl.org/dc/terms/"),
ddgrm(L"ddgrm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm(L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm (L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dlckcnv(L"dlckcnv", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"),
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds(L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m(L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
o(L"o", L"urn:schemas-microsoft-com:office:office"),
p(L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
pic(L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
r(L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s(L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl(L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v(L"v", L"urn:schemas-microsoft-com:vml"),
ve(L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp(L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt(L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w(L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10(L"w10", L"urn:schemas-microsoft-com:office:word"),
wne(L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
wp(L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x(L"x", L"urn:schemas-microsoft-com:office:excel"),
xdr(L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds (L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m (L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
o (L"o", L"urn:schemas-microsoft-com:office:office"),
p (L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
pic (L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
r (L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s (L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl (L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v (L"v", L"urn:schemas-microsoft-com:vml"),
ve (L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp (L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt (L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w (L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10 (L"w10", L"urn:schemas-microsoft-com:office:word"),
wne (L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
wp (L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x (L"x", L"urn:schemas-microsoft-com:office:excel"),
xdr (L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
xmlns(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"),
xsd(L"xsd", L"http://www.w3.org/2001/XMLSchema"),
xsi(L"xsi", L"http://www.w3.org/2001/XMLSchema-instance")
xsd (L"xsd", L"http://www.w3.org/2001/XMLSchema"),
xsi (L"xsi", L"http://www.w3.org/2001/XMLSchema-instance"),
p14 (L"p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main")
{
}
@ -124,6 +126,7 @@ namespace PPTX
const Namespace xmlns;
const Namespace xsd;
const Namespace xsi;
const Namespace p14;
};
static Namespaces g_Namespaces;

View File

@ -58,7 +58,6 @@ namespace PPTX
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
//FileContainer::read(filename, map);
@ -85,8 +84,6 @@ namespace PPTX
WrapperFile::write(filename, directory, content);
FileContainer::write(filename, directory, content);
}
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::NotesMaster;
@ -186,10 +183,48 @@ namespace PPTX
pReader->Seek(end);
}
virtual void GetLevelUp(Logic::Shape* pShape)
{
if (!pShape) return;
public:
smart_ptr<Theme> theme_;
smart_ptr<TableStyles> tableStyles_;
if (pShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(L"");
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(L"body");
if (type == L"ctrTitle") type = L"title";
for (size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
{
smart_ptr<Logic::Shape> pMasterShape = cSld.spTree.SpTreeElems[i].GetElem().smart_dynamic_cast<Logic::Shape>();
if (pMasterShape.IsInit())
{
if (pMasterShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring lIdx = pMasterShape->nvSpPr.nvPr.ph->idx.get_value_or(_T(""));
std::wstring lType = pMasterShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if (lType == L"ctrTitle") lType = L"title";
if ((type == lType) && (idx == lIdx) && !idx.empty())
{
pShape->SetLevelUpElement(pMasterShape.operator->());
return;
}
else if ((type == lType) && idx.empty() && lIdx.empty())
{
pShape->SetLevelUpElement(pMasterShape.operator->());
return;
}
}
}
}
}
}
smart_ptr<Theme> theme_;
smart_ptr<TableStyles> tableStyles_;
Logic::CSld cSld;
Logic::ClrMap clrMap;

View File

@ -37,8 +37,7 @@
#include "FileContainer.h"
#include "FileTypes.h"
#include "Logic/ClrMapOvr.h"
#include "Logic/CSld.h"
#include "NotesMaster.h"
namespace PPTX
{
@ -55,8 +54,6 @@ namespace PPTX
virtual ~NotesSlide()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
//FileContainer::read(filename, map);
@ -79,8 +76,6 @@ namespace PPTX
WrapperFile::write(filename, directory, content);
FileContainer::write(filename, directory, content);
}
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::NotesSlide;
@ -127,7 +122,6 @@ namespace PPTX
pWriter->EndNode(_T("p:notes"));
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
pReader->Skip(1); // type
@ -145,7 +139,6 @@ namespace PPTX
else if (1 == _at)
showMasterSp = pReader->GetBool();
}
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
@ -173,13 +166,25 @@ namespace PPTX
pReader->Seek(end);
}
void ApplyRels()
{
smart_ptr<OOX::File> pFile = FileContainer::Get(OOX::Presentation::FileTypes::NotesMaster);
public:
master_ = pFile.smart_dynamic_cast<PPTX::NotesMaster>();
if (master_.IsInit())
{
theme_ = master_->theme_;
}
}
Logic::CSld cSld;
nullable<Logic::ClrMapOvr> clrMapOvr;
nullable_bool showMasterPhAnim;
nullable_bool showMasterSp;
smart_ptr<NotesMaster> master_;
smart_ptr<Theme> theme_;
};
} // namespace PPTX

View File

@ -37,19 +37,19 @@
#include "FileContainer.h"
#include "FileTypes.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Theme/ClrScheme.h"
#include "Presentation/EmbeddedFont.h"
#include "Presentation/Kinsoku.h"
#include "Presentation/NotesSz.h"
#include "Presentation/PhotoAlbum.h"
#include "Logic/XmlId.h"
#include "Presentation/SldSz.h"
#include "CommentAuthors.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Logic/ExtP.h"
#include "Theme/ClrScheme.h"
namespace PPTX
{
class Presentation : public WrapperFile, public PPTX::FileContainer
@ -87,7 +87,6 @@ namespace PPTX
oNode.ReadAttributeBase(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
oNode.ReadAttributeBase(L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
//custDataLst (Customer Data List)
//custShowLst (List of Custom Shows)
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
@ -100,8 +99,7 @@ namespace PPTX
{
oNodeEmbeddedFonts.LoadArray(_T("p:embeddedFont"), embeddedFontLst);
size_t count = embeddedFontLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < embeddedFontLst.size(); ++i)
embeddedFontLst[i].SetParentFilePointer(this);
}
@ -111,8 +109,7 @@ namespace PPTX
{
oNodeHMList.LoadArray(_T("p:handoutMasterId"), handoutMasterIdLst);
size_t count = handoutMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
handoutMasterIdLst[i].SetParentFilePointer(this);
}
@ -128,8 +125,7 @@ namespace PPTX
{
oNodeMIDList.LoadArray(_T("p:notesMasterId"), notesMasterIdLst);
size_t count = notesMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
notesMasterIdLst[i].SetParentFilePointer(this);
}
@ -147,8 +143,7 @@ namespace PPTX
{
oNode_sldId.LoadArray(_T("p:sldId"), sldIdLst);
size_t count = sldIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < sldIdLst.size(); ++i)
sldIdLst[i].SetParentFilePointer(this);
}
@ -158,16 +153,36 @@ namespace PPTX
{
oNode_sldM_Id.LoadArray(_T("p:sldMasterId"), sldMasterIdLst);
size_t count = sldMasterIdLst.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
sldMasterIdLst[i].SetParentFilePointer(this);
}
sldSz = oNode.ReadNode(_T("p:sldSz"));
if (sldSz.is_init())
sldSz->SetParentFilePointer(this);
//smartTags (Smart Tags)
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
if (list.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (list.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
PPTX::Logic::Ext ext;
ext.fromXML(oNode);
if (ext.sectionLst.IsInit())
{
sectionLst = ext.sectionLst;
}
}
}
}
//smartTags (Smart Tags)
Normalize();
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
@ -205,6 +220,7 @@ namespace PPTX
pWriter->WriteRecord2(5, sldSz);
pWriter->WriteRecord2(6, commentAuthors);
pWriter->WriteRecord2(7, sectionLst);
pWriter->EndRecord();
}
@ -312,6 +328,12 @@ namespace PPTX
commentAuthors->fromPPTY(pReader);
break;
}
case 7:
{
sectionLst = new nsPresentation::SectionLst();
sectionLst->fromPPTY(pReader);
break;
}
default:
{
pReader->Seek(_end_pos);
@ -350,11 +372,11 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteArray(_T("p:sldMasterIdLst"), sldMasterIdLst);
pWriter->WriteArray(_T("p:notesMasterIdLst"), notesMasterIdLst);
pWriter->WriteArray(_T("p:handoutMasterIdLst"), handoutMasterIdLst);
pWriter->WriteArray(_T("p:embeddedFontLst"), embeddedFontLst);
pWriter->WriteArray(_T("p:sldIdLst"), sldIdLst);
pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
pWriter->Write(sldSz);
pWriter->Write(notesSz);
@ -362,7 +384,17 @@ namespace PPTX
pWriter->Write(kinsoku);
pWriter->Write(defaultTextStyle);
pWriter->EndNode(_T("p:presentation"));
std::vector<Logic::Ext> extLst;
if (sectionLst.IsInit())
{
Logic::Ext exp;
exp.sectionLst = sectionLst;
extLst.push_back(exp);
}
pWriter->WriteArray(L"p:extLst", extLst);
pWriter->EndNode(L"p:presentation");
}
public:
@ -380,7 +412,7 @@ namespace PPTX
}
public:
//Childs
//Childs
//custDataLst (Customer Data List)
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
nullable<Logic::TextListStyle> defaultTextStyle;
@ -394,6 +426,7 @@ namespace PPTX
std::vector<Logic::XmlId> sldIdLst;
std::vector<Logic::XmlId> sldMasterIdLst;
nullable<nsPresentation::SldSz> sldSz;
nullable<nsPresentation::SectionLst> sectionLst;
//smartTags (Smart Tags)
// Attrs

View File

@ -0,0 +1,247 @@
/*
* (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 "../Logic/XmlId.h"
namespace PPTX
{
namespace Logic
{
class Section : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Section)
nullable_string id;
nullable_string name;
std::vector<Logic::XmlId> arSldIdLst;
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"id", id);
node.ReadAttributeBase(L"name", name);
XmlUtils::CXmlNode oNodeSldIdLst;
if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst))
{
oNodeSldIdLst.LoadArray(L"p14:sldId", arSldIdLst);
}
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"p14:section");
pWriter->StartAttributes();
pWriter->WriteAttribute2(L"name", name);
pWriter->WriteAttribute(L"id", id);
pWriter->EndAttributes();
pWriter->StartNode(L"p14:sldIdLst");
pWriter->WriteArray2(arSldIdLst);
pWriter->EndNode(L"p14:sldIdLst");
pWriter->EndNode(L"p14:section");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, id);
pWriter->WriteString2(1, name);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecordArray(0, 0, arSldIdLst);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetString2();
break;
case 1:
name = pReader->GetString2();
break;
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4); // len
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
Logic::XmlId sldId(L"p14:sldId");
arSldIdLst.push_back(sldId);
arSldIdLst.back().fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(_end_rec);
}
virtual void FillParentPointersForChilds()
{
}
};
}
namespace nsPresentation
{
class SectionLst : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SectionLst)
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
Logic::Section sect;
arSectionLst.push_back(sect);
arSectionLst.back().fromXML(oNode);
}
}
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4); // len
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
Logic::Section sect;
arSectionLst.push_back(sect);
arSectionLst.back().fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(end);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecordArray(0, 0, arSectionLst);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"p14:sectionLst");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(arSectionLst);
pWriter->EndNode(L"p14:sectionLst");
}
std::vector<Logic::Section> arSectionLst;
protected:
virtual void FillParentPointersForChilds(){};
};
}
} // namespace PPTX

View File

@ -2987,6 +2987,10 @@
RelativePath="..\.\PPTXFormat\Presentation.h"
>
</File>
<File
RelativePath="..\PPTXFormat\Presentation\SectionLst.h"
>
</File>
<File
RelativePath="..\.\PPTXFormat\Presentation\SldSz.h"
>

View File

@ -562,6 +562,7 @@
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -595,6 +596,7 @@
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",

View File

@ -969,6 +969,8 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
PPTX::Theme *theme = oParam.oDocx->GetTheme();
if (!theme || fmt_index <0) return;
if (style_ref->Color.is<PPTX::Logic::SchemeClr>() == false) return;
PPTX::Logic::SchemeClr & schemeClr = style_ref->Color.as<PPTX::Logic::SchemeClr>();
std::wstring color = schemeClr.val.get();

View File

@ -47,24 +47,21 @@
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 3) return 0;
if (argc < 2) return 0;
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>1000</Encoding></TXTOptions></Options>");
std::wstring sXMLOptions = _T("<Options><TXTOptions><Encoding>50</Encoding></TXTOptions></Options>");
std::wstring srcFileName = argv[1];
std::wstring dstFileName = argv[2];
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
int n1 = srcFileName.rfind(L".");
int n2 = dstFileName.rfind(L".");
std::wstring ext_1 = n1>=0 ? srcFileName.substr(n1+1, srcFileName.length() - n1): L""; //ext_1.MakeLower();
std::wstring ext_2 = n2>=0 ? dstFileName.substr(n2+1, dstFileName.length() - n2): L""; //ext_2.MakeLower();
int n1 = srcFileName.rfind(_T('.'));
std::wstring ext_1 = n1 >= 0 ? srcFileName.substr(n1+1, srcFileName.length() - n1) : _T("");
std::transform(ext_1.begin(), ext_1.end(), ext_1.begin(), ::tolower);
std::wstring dstFileName = argc > 2 ? argv[2] : srcFileName + L"_my." + (ext_1 == L"txt" ? L"docx" : L"txt");
std::wstring outputDir = NSDirectory::GetFolderPath(dstFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
CTxtXmlFile txtFile;
COfficeUtils oCOfficeUtils(NULL);
@ -77,7 +74,7 @@ int _tmain(int argc, _TCHAR* argv[])
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstFileName.c_str(), -1))
return S_FALSE;
}
if (ext_2 == L"txt")
else
{
// docx->txt
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), dstTempPath.c_str(), NULL, 0))

View File

@ -85,7 +85,7 @@ namespace Docx2Txt
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
size_t NoteCount;
std::list<std::wstring> Notes;
std::map<std::wstring, std::list<std::wstring>> Notes;
static std::wstring IntToLowerLetter (int number);
static std::wstring IntToUpperLetter (int number);
@ -198,10 +198,20 @@ namespace Docx2Txt
if(NoteCount != 0)
{
m_outputFile.m_listContent.push_back(_T("---------------------------"));
for(std::list<std::wstring>::const_iterator iter = Notes.begin(); iter != Notes.end(); iter++)
m_outputFile.m_listContent.push_back(L"");
m_outputFile.m_listContent.push_back(L"---------------------------");
for(std::map<std::wstring, std::list<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
{
m_outputFile.m_listContent.push_back(*iter);
bool bFirst = true;
for(std::list<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
{
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
else m_outputFile.m_listContent.push_back(*iter);
bFirst = false;
}
}
}
}
@ -491,31 +501,52 @@ namespace Docx2Txt
if (run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference || run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
{// todooo Ref ????
std::list<std::wstring> notes_content;
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(run->m_arrItems[j]);
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(run->m_arrItems[j]);
NoteCount++;
std::wstring s = _T("[") + ToWString(NoteCount) + _T("]");
Notes.push_back(s);
if(run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference)
if (footnote_ref)
{
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::FootNote);
if (pFile.IsInit())
{
OOX::CFootnotes *pFootnotes = (OOX::CFootnotes*)pFile.operator->();
for (long r =0 ;r < pFootnotes->m_arrFootnote.size(); r++)
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
for (size_t r = 0; r < pFootnotes->m_arrFootnote.size(); r++)
{
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pFootnotes->m_arrFootnote[r]);
if (note && note->m_oId == footnote_ref->m_oId)
{
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
}
}
}
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
}
else if(run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
if (endnote_ref)
{
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::EndNote);
if (pFile.IsInit())
{
OOX::CEndnotes *pEndnotes = (OOX::CEndnotes*)pFile.operator->();
for (long r =0 ;r < pEndnotes->m_arrEndnote.size(); r++)
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, Notes, Event, false, pDocument, pNumbering, pStyles);
for (size_t r =0; r < pEndnotes->m_arrEndnote.size(); r++)
{
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pEndnotes->m_arrEndnote[r]);
if (note && note->m_oId == endnote_ref->m_oId)
{
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
}
}
}
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
}
wstr.replace(wstr.find(_T("_")), 1 , ToWString(NoteCount));
wstr += L"[" + ToWString(NoteCount) + L"]"; ;
}
line += wstr;
}

View File

@ -51,7 +51,7 @@ const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8without
std::list<std::string> result;
NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result;
if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
@ -118,7 +118,7 @@ const std::list<std::wstring> TxtFile::readUnicode()
std::list<std::wstring> result;
NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result;
if (file_binary.OpenFile(m_path) == false ) return result;
DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
@ -135,7 +135,7 @@ const std::list<std::wstring> TxtFile::readBigEndian()
std::list<std::wstring> result;
NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result;
if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
@ -160,7 +160,7 @@ const std::list<std::string> TxtFile::readUtf8()
std::list<std::string> result;
NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result;
if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];

View File

@ -104,13 +104,6 @@ static int ParseTxtOptions(const std::wstring & sXmlOptions)
HRESULT CTxtXmlFile::txt_LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstPath, const std::wstring & sXMLOptions)
{
//проверка на структуру xml - если что не так выкинет быстро
//HRESULT hr = xml_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
//if(hr == S_OK)
// return S_OK;
//As Text
Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, L"", true, 1, false, NULL, L"");
if (pDocxWriter == NULL) return S_FALSE;

View File

@ -51,7 +51,6 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeBRAI;

View File

@ -58,10 +58,17 @@ BaseObjectPtr DConn::clone()
void DConn::readFields(CFRecord& record)
{
unsigned short flags1, reserved1;
unsigned char flags2, reserved2;
unsigned char flags2, reserved2, reserved3;
record >> frtHeaderOld >> dbt >> flags1 >> cParams >> reserved1 >> flags2 >> reserved2;
//DBT_ODBC 0x0001 ODBC-based source
//DBT_DAO 0x0002 DAO-based source
//DBT_WEB 0x0004 Web query
//DBT_OLEDB 0x0005 OLE DB-based source
//DBT_TXT 0x0006 Text-based source created via text query
//DBT_ADO 0x0007 ADO record set
fSavePwd = GETBIT(flags1, 0);
fTablesOnlyHtml = GETBIT(flags1, 1);
fTableNames = GETBIT(flags1, 2);
@ -84,17 +91,39 @@ void DConn::readFields(CFRecord& record)
case 4: grbitDbt.reset(new ConnGrbitDbtWeb); break;
case 5: grbitDbt.reset(new ConnGrbitDbtOledb); break;
case 7: grbitDbt.reset(new ConnGrbitDbtAdo); break;
default:
break;
}
if (grbitDbt)
{
record >> *grbitDbt;
}
else
{
unsigned short unused;
record >> unused;
}
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> wHtmlFmt >> rcc >> credMethod;
record >> bVerDbqueryEdit >> bVerDbqueryRefreshed >> bVerDbqueryRefreshableMin >> wRefreshInterval >> wHtmlFmt >> rcc >> credMethod >> reserved3;
record >> rgchSourceDataFile >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc >> rgchSSOApplicationID >> tableNames;
if (dbt == 5)
{
record >> rgchSourceDataFile;
}
for ( unsigned short i = 0; i < cParams; i++)
record >> rgchSourceConnectionFile >> rgchConnectionName >> rgchConnectionDesc;
if (dbt == 1 || dbt == 5)
{
record >> rgchSSOApplicationID;
}
if (fTableNames)
{
record >> tableNames;
}
for ( unsigned short i = 0; fStandAlone && i < cParams; i++)
{
DConnParameter val;
params.push_back(val);
@ -111,7 +140,22 @@ void DConn::readFields(CFRecord& record)
if (connection)
record >> *connection;
record >> rgbSQL >> rgbSQLSav >> rgbEditWebPage >> id;
if (dbt == 1 || dbt == 5)
{
record >> rgbSQL;
}
if (dbt == 1)
{
record >> rgbSQLSav;
}
if (dbt == 4)
{
record >> rgbEditWebPage;
}
record >> id;
int skip = record.getDataSize() - record.getRdPtr();

View File

@ -215,20 +215,30 @@ void XLUnicodeStringSegmented::load(CFRecord& record)
record >> cchTotal;
if (cchTotal < 1) return;
if (cchTotal > record.getDataSize() - record.getRdPtr())
{
cchTotal = cchTotal >> 8;
}
_UINT32 cchTotal_test = 0;
while(true)
{
if (record.isEOF())
break;
if (cchTotal_test >= cchTotal)
break;
_UINT32 max_string_size = cchTotal - cchTotal_test;
XLUnicodeString string;
record >> string;
cchTotal_test += string.value().length();
arStrings.push_back(string.value());
strTotal += string.value();
cchTotal_test += arStrings.back().length();
strTotal += arStrings.back();
}
}

View File

@ -71,6 +71,10 @@ void PtgStr::loadFields(CFRecord& record)
{
string_ = string_.substr(1, string_.length() - 2);
}
else if (pos1 > 0)
{
boost::algorithm::replace_all(string_, L"\"", L"\"\"");
}
string_ = L"\"" + string_ + L"\"";
}

View File

@ -67,6 +67,10 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
if ((name) && (name->ifdb >= 0 && name->ifdb < global_info->arPivotCacheSxNames.size()))
{
_Name = global_info->arPivotCacheSxNames[name->ifdb];
if (std::wstring::npos != _Name.find(L" "))
{
_Name = L"'" + _Name + L"'";
}
}
else if (!global_info->arPivotSxNames[sxIndex].pair.empty())
{

View File

@ -81,8 +81,6 @@ const bool CHART::loadContent(BinProcessor& proc)
elements_.pop_back();
count--;
}
// reader.SeekNextSubstream();
return true;
}

View File

@ -97,7 +97,7 @@ int DBB::serialize(std::wostream & strm)
for (size_t i = 0; i < arPivotCacheFields.size(); i++)
{
if(arPivotCacheFields[i] == false)
if(arPivotCacheFields[i] == false && indexOPER < m_arSXOPER.size())
{
m_arSXOPER[indexOPER++]->serialize(CP_XML_STREAM());
}

View File

@ -206,8 +206,8 @@ int DBQUERY::serialize_connection(std::wostream & strm)
{
CP_XML_NODE(L"connection")
{
CP_XML_ATTR(L"id", 1); //connectionId in connections(root)
CP_XML_ATTR(L"name", L"Connection");
CP_XML_ATTR(L"id", connectionId);
CP_XML_ATTR(L"name", L"Connection" + std::to_wstring(connectionId));
CP_XML_ATTR(L"type", queryOrParam->query.dbt);
//switch(queryOrParam->query.dbt)
@ -222,22 +222,24 @@ int DBQUERY::serialize_connection(std::wostream & strm)
//}
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"savePassword", 1);
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"refreshedVersion", 1);
CP_XML_ATTR(L"refreshedVersion", 1);
int index = 0;
CP_XML_NODE(L"dbPr")
{
if (index < m_arSXString.size())
std::wstring command, connection;
for (index = 0; index < queryOrParam->query.cstQuery; index++)
{
CP_XML_ATTR(L"command", m_arSXString[index]);
command += m_arSXString[index];
}
index++;
if (index < m_arSXString.size())
for (; index < queryOrParam->query.cstQuery + queryOrParam->query.cstOdbcConn; index++)
{
CP_XML_ATTR(L"connection", m_arSXString[index]);
connection += m_arSXString[index];
}
index++;
CP_XML_ATTR(L"connection", connection);
CP_XML_ATTR(L"command", command);
}
}
}

View File

@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc)
return true;
}
int FDB::serialize(std::wostream & strm)
int FDB::serialize(std::wostream & strm, bool bSql)
{
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
@ -189,14 +189,21 @@ int FDB::serialize(std::wostream & strm)
CP_XML_NODE(L"cacheField")
{
CP_XML_ATTR(L"name", fdb->stFieldName.value());
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
//CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql); //in db
if (bSql)
{
CP_XML_ATTR(L"numFmtId", 0);
if (fdb_type->wTypeSql > 0)
CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql);
}
else
{
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
}
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
{
CP_XML_ATTR(L"databaseField", 0);
}
switch(fdb_type->wTypeSql)//format code
{
case 0x0000:

View File

@ -47,7 +47,7 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
int serialize(std::wostream & strm, bool bSql);
static const ElementType type = typeFDB;

View File

@ -34,6 +34,7 @@
#include "PIVOTCACHE.h"
#include "SXSRC.h"
#include "SXADDLCACHE.h"
#include "FDB.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/SXVS.h"
@ -110,6 +111,8 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
if (!db || !db_ex)return 0;
bool bSql = false;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotCacheDefinition")
@ -124,13 +127,16 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
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", db->crdbUsed);
CP_XML_ATTR(L"recordCount", db->crdbdb);
//createdVersion="1"
//refreshedVersion="2"
//upgradeOnRefresh="1">
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
if (src)
{
bSql = src->bSql;
src->serialize(CP_XML_STREAM());
}
if (pivot_cache->m_arFDB.empty() == false)
{
@ -140,7 +146,10 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
{
pivot_cache->m_arFDB[i]->serialize(CP_XML_STREAM());
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
if (!field) continue;
field->serialize(CP_XML_STREAM(), bSql);
}
}
}

View File

@ -68,6 +68,14 @@ const bool PIVOTVIEW::loadContent(BinProcessor& proc)
}
m_PIVOTCORE = elements_.back();
elements_.pop_back();
PIVOTCORE *core = dynamic_cast<PIVOTCORE*>(m_PIVOTCORE.get());
SxView* view = dynamic_cast<SxView*>(core->m_SxView.get());
if (view)
{
name = view->stTable.value();
}
if (proc.optional<PIVOTFRT>())
{
@ -185,12 +193,15 @@ int PIVOTVIEW::serialize(std::wostream & strm)
core->m_PIVOTPI->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"dataFields")
if (core->m_arSXDI.empty() == false)
{
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
CP_XML_NODE(L"dataFields")
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
}
}
}
//CP_XML_NODE(L"pivotTableStyleInfo")

View File

@ -54,7 +54,8 @@ public:
BaseObjectPtr m_PIVOTCORE;
BaseObjectPtr m_PIVOTFRT;
//----------------------------------
int indexCache;
int indexCache;
std::wstring name;
};
} // namespace XLS

View File

@ -31,38 +31,36 @@
*/
#include "SERIESFORMAT.h"
#include <Logic/Biff_records/Series.h>
#include <Logic/Biff_records/Begin.h>
#include <Logic/Biff_records/SerToCrt.h>
#include <Logic/Biff_records/SerParent.h>
#include <Logic/Biff_records/SerAuxTrend.h>
#include <Logic/Biff_records/SerAuxErrBar.h>
#include <Logic/Biff_records/LegendException.h>
#include <Logic/Biff_records/End.h>
#include <Logic/Biff_records/SerAuxTrend.h>
#include <Logic/Biff_records/SerAuxErrBar.h>
#include <Logic/Biff_records/AttachedLabel.h>
#include "AI.h"
#include "SS.h"
#include "ATTACHEDLABEL.h"
#include "TEXTPROPS.h"
#include "CHARTFOMATS.h"
#include <Logic/Biff_unions/AI.h>
#include <Logic/Biff_unions/SS.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h>
#include <Logic/Biff_unions/TEXTPROPS.h>
#include <Logic/Biff_unions/CHARTFOMATS.h>
#include "../Biff_records/Series.h"
#include "../Biff_records/Begin.h"
#include "../Biff_records/SerToCrt.h"
#include "../Biff_records/SerParent.h"
#include "../Biff_records/SerAuxTrend.h"
#include "../Biff_records/SerAuxErrBar.h"
#include "../Biff_records/LegendException.h"
#include "../Biff_records/End.h"
#include "../Biff_records/SerAuxTrend.h"
#include "../Biff_records/SerAuxErrBar.h"
#include "../Biff_records/AttachedLabel.h"
#include "../Biff_records/BRAI.h"
namespace XLS
{
SERIESFORMAT::SERIESFORMAT()
{
}
SERIESFORMAT::~SERIESFORMAT()
{
}
// (SerToCrt / (SerParent (SerAuxTrend / SerAuxErrBar)))
class Parenthesis_SERIESFORMAT_1: public ABNFParenthesis
{
@ -353,5 +351,6 @@ int SERIESFORMAT::serialize_parent(std::wostream & _stream, CHARTFORMATS* chart_
return 0;
}
} // namespace XLS

View File

@ -75,7 +75,6 @@ public:
//-----------------------------------------------------------------------
BaseObjectPtr m_SERIESFORMAT_ext;
};
} // namespace XLS

View File

@ -38,6 +38,8 @@
#include "../Biff_records/SXString.h"
#include "../Biff_records/SXDtr.h"
#include <boost/lexical_cast.hpp>
namespace XLS
{
@ -75,14 +77,15 @@ const bool SXOPER::loadContent(BinProcessor& proc)
SXNum *num = dynamic_cast<SXNum*>(elements_.back().get());
if (num)
{
bInteger = (num->num.data.bytes.Byte1==num->num.data.bytes.Byte2 &&
num->num.data.bytes.Byte2==num->num.data.bytes.Byte3 &&
num->num.data.bytes.Byte3==num->num.data.bytes.Byte4 &&
num->num.data.bytes.Byte4==0);
bInteger = !(num->num.data.value - floor(num->num.data.value) > 0);
bNumber = !bInteger;
node = L"n";
if (bInteger)
value = std::to_wstring((int)num->num.data.value);
else
value = boost::lexical_cast<std::wstring>(num->num.data.value);
}
bNumber = !bInteger;
node = L"n";
value = std::to_wstring(num->num.data.value);
}
else if(proc.optional<SxBool>())
{

View File

@ -38,9 +38,9 @@
namespace XLS
{
SXSRC::SXSRC()
{
bSql = false;
}
@ -57,6 +57,7 @@ BaseObjectPtr SXSRC::clone()
// SXSRC = DREF / SXTBL / DBQUERY
const bool SXSRC::loadContent(BinProcessor& proc)
{
bSql = false;
if(!proc.optional<DREF>())
{
if(!proc.optional<SXTBL>())
@ -65,6 +66,7 @@ const bool SXSRC::loadContent(BinProcessor& proc)
{
return false;
}
bSql = true;
}
}
m_source = elements_.back();

View File

@ -52,6 +52,7 @@ public:
static const ElementType type = typeSXSRC;
BaseObjectPtr m_source;
bool bSql;
};
} // namespace XLS

View File

@ -32,64 +32,65 @@
#include "ChartSheetSubstream.h"
#include <Logic/Biff_records/WriteProtect.h>
#include <Logic/Biff_records/SheetExt.h>
#include <Logic/Biff_records/WebPub.h>
#include <Logic/Biff_records/HFPicture.h>
#include <Logic/Biff_records/PrintSize.h>
#include <Logic/Biff_records/HeaderFooter.h>
#include <Logic/Biff_records/Fbi.h>
#include <Logic/Biff_records/Fbi2.h>
#include <Logic/Biff_records/ClrtClient.h>
#include <Logic/Biff_records/Palette.h>
#include <Logic/Biff_records/SXViewLink.h>
#include <Logic/Biff_records/PivotChartBits.h>
#include <Logic/Biff_records/SBaseRef.h>
#include <Logic/Biff_records/MsoDrawingGroup.h>
#include <Logic/Biff_records/Units.h>
#include <Logic/Biff_records/CodeName.h>
#include <Logic/Biff_records/EOF.h>
#include <Logic/Biff_records/BOF.h>
#include <Logic/Biff_records/AreaFormat.h>
#include <Logic/Biff_records/SerToCrt.h>
#include <Logic/Biff_records/AxisParent.h>
#include <Logic/Biff_records/Series.h>
#include <Logic/Biff_records/BRAI.h>
#include <Logic/Biff_records/SIIndex.h>
#include <Logic/Biff_records/DataFormat.h>
#include <Logic/Biff_records/Text.h>
#include <Logic/Biff_records/Pos.h>
#include <Logic/Biff_records/Pie.h>
#include <Logic/Biff_records/ShtProps.h>
#include <Logic/Biff_records/Chart3d.h>
#include <Logic/Biff_records/ChartFormat.h>
#include <Logic/Biff_records/Legend.h>
#include <Logic/Biff_records/AttachedLabel.h>
#include <Logic/Biff_records/DataLabExtContents.h>
#include <Logic/Biff_records/CrtLine.h>
#include <Logic/Biff_records/Dat.h>
#include <Logic/Biff_records/Chart.h>
#include <Logic/Biff_records/ExternSheet.h>
#include "Biff_records/WriteProtect.h"
#include "Biff_records/SheetExt.h"
#include "Biff_records/WebPub.h"
#include "Biff_records/HFPicture.h"
#include "Biff_records/PrintSize.h"
#include "Biff_records/HeaderFooter.h"
#include "Biff_records/Fbi.h"
#include "Biff_records/Fbi2.h"
#include "Biff_records/ClrtClient.h"
#include "Biff_records/Palette.h"
#include "Biff_records/SXViewLink.h"
#include "Biff_records/PivotChartBits.h"
#include "Biff_records/SBaseRef.h"
#include "Biff_records/MsoDrawingGroup.h"
#include "Biff_records/Units.h"
#include "Biff_records/CodeName.h"
#include "Biff_records/EOF.h"
#include "Biff_records/BOF.h"
#include "Biff_records/AreaFormat.h"
#include "Biff_records/SerToCrt.h"
#include "Biff_records/AxisParent.h"
#include "Biff_records/Series.h"
#include "Biff_records/BRAI.h"
#include "Biff_records/SIIndex.h"
#include "Biff_records/DataFormat.h"
#include "Biff_records/Text.h"
#include "Biff_records/Pos.h"
#include "Biff_records/Pie.h"
#include "Biff_records/ShtProps.h"
#include "Biff_records/Chart3d.h"
#include "Biff_records/ChartFormat.h"
#include "Biff_records/Legend.h"
#include "Biff_records/AttachedLabel.h"
#include "Biff_records/DataLabExtContents.h"
#include "Biff_records/CrtLine.h"
#include "Biff_records/Dat.h"
#include "Biff_records/Chart.h"
#include "Biff_records/ExternSheet.h"
#include <Logic/Biff_unions/PAGESETUP.h>
#include <Logic/Biff_unions/BACKGROUND.h>
#include <Logic/Biff_unions/PROTECTION_COMMON.h>
#include <Logic/Biff_unions/OBJECTS.h>
#include <Logic/Biff_unions/CHARTFOMATS.h>
#include <Logic/Biff_unions/SERIESDATA.h>
#include <Logic/Biff_unions/WINDOW.h>
#include <Logic/Biff_unions/CUSTOMVIEW.h>
#include <Logic/Biff_unions/CRTMLFRT.h>
#include <Logic/Biff_unions/FRAME.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h>
#include <Logic/Biff_unions/SERIESFORMAT.h>
#include <Logic/Biff_unions/CRT.h>
#include <Logic/Biff_unions/AXISPARENT.h>
#include <Logic/Biff_unions/AXES.h>
#include <Logic/Biff_unions/SS.h>
#include <Logic/Biff_unions/AI.h>
#include <Logic/Biff_unions/LD.h>
#include <Logic/Biff_unions/DAT.h>
#include "Biff_unions/PAGESETUP.h"
#include "Biff_unions/BACKGROUND.h"
#include "Biff_unions/PROTECTION_COMMON.h"
#include "Biff_unions/OBJECTS.h"
#include "Biff_unions/CHARTFOMATS.h"
#include "Biff_unions/SERIESDATA.h"
#include "Biff_unions/WINDOW.h"
#include "Biff_unions/CUSTOMVIEW.h"
#include "Biff_unions/CRTMLFRT.h"
#include "Biff_unions/FRAME.h"
#include "Biff_unions/ATTACHEDLABEL.h"
#include "Biff_unions/SERIESFORMAT.h"
#include "Biff_unions/CRT.h"
#include "Biff_unions/AXISPARENT.h"
#include "Biff_unions/AXES.h"
#include "Biff_unions/SS.h"
#include "Biff_unions/AI.h"
#include "Biff_unions/LD.h"
#include "Biff_unions/DAT.h"
#include "Biff_unions/PIVOTVIEW.h"
#include "../../XlsXlsxConverter/XlsConverter.h"
#include "../../XlsXlsxConverter/xlsx_conversion_context.h"
@ -377,15 +378,14 @@ void ChartSheetSubstream::recalc(SERIESDATA* data)
{
}
int ChartSheetSubstream::serialize (std::wostream & _stream)
int ChartSheetSubstream::serialize(std::wostream & _stream)
{
AreaFormat *chart_area_format = NULL;
CHARTFORMATS *chart_formats = dynamic_cast<CHARTFORMATS*>(m_CHARTFORMATS.get());
if (!chart_formats) return 0;
AreaFormat *chart_area_format = NULL;
FRAME *chart_frame = dynamic_cast<FRAME*>(chart_formats->m_FRAME.get());
if (chart_frame)
chart_area_format = dynamic_cast<AreaFormat*>(chart_frame->m_AreaFormat.get());
if (chart_frame) chart_area_format = dynamic_cast<AreaFormat*>(chart_frame->m_AreaFormat.get());
ShtProps *sht_props = dynamic_cast<ShtProps*>(chart_formats->m_ShtProps.get());
Chart *chart_rect = dynamic_cast<Chart*>(chart_formats->m_ChartRect.get());
@ -453,6 +453,40 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
}
}
}
if (m_SXViewLink)
{
CP_XML_NODE(L"c:extLst")
{
CP_XML_NODE(L"c:ext")
{
CP_XML_ATTR(L"uri", L"{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}");
CP_XML_ATTR(L"xmlns:c14", L"http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
CP_XML_NODE(L"c14:pivotOptions")
{
CP_XML_NODE(L"c14:dropZoneFilter")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneCategories")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneData")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZoneSeries")
{
CP_XML_ATTR(L"val", 1);
}
CP_XML_NODE(L"c14:dropZonesVisible")
{
CP_XML_ATTR(L"val", 1);
}
}
}
}
}
}
if (chart_rect)
@ -733,7 +767,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
}
format->serialize(CP_XML_STREAM());
for (int i = 0 ; i < it->second.size(); i++)
for (size_t i = 0 ; i < it->second.size(); i++)
{
SERIESFORMAT * series = dynamic_cast<SERIESFORMAT *>(chart_formats->m_arSERIESFORMAT[it->second[i]].get());
if (series == NULL) continue;
@ -766,6 +800,11 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
serialize_dPt(CP_XML_STREAM(), it->second[i], crt, (std::max)(ser->cValx, ser->cValy));//+bubbles
/* if (arPivotData.empty() == false)
{
series->set_ref(arPivotData, i * 2);
}*/
if (crt->m_iChartType == CHART_TYPE_Scatter ||
crt->m_iChartType == CHART_TYPE_Bubble)
{
@ -777,6 +816,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
}
else
{
serialize_ser(L"c:cat", CP_XML_STREAM(), series_id, series->m_arAI[2], ser->sdtX, ser->cValx);
serialize_ser(L"c:val", CP_XML_STREAM(), series_id, series->m_arAI[1], ser->sdtY, ser->cValy);
}

View File

@ -77,10 +77,10 @@ public:
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
BaseObjectPtr m_Units;
BaseObjectPtr m_ExternSheet;
BaseObjectPtr m_SXViewLink;
BaseObjectPtr m_PivotChartBits;
BaseObjectPtr m_SBaseRef;
private:
void recalc(CHARTFORMATS* charts);
@ -88,10 +88,7 @@ private:
std::map<int, std::vector<int>> m_mapTypeChart;//тут нужен несортированый .. пока оставим этот
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
};
} // namespace XLS

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