Compare commits

...

33 Commits

Author SHA1 Message Date
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
c985d1e0a2 OdfFormatWriter - data label position
XlsFormatReader - fix pivots
2017-07-18 19:25:39 +03:00
5aaf90ebf2 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-17 19:43:41 +03:00
ebb9c89a0a fix bug #35389 2017-07-17 19:42:35 +03:00
122 changed files with 2925 additions and 542 deletions

View File

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

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
{

View File

@ -7714,9 +7714,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

@ -217,7 +217,7 @@ namespace formulasconvert {
{
convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/*
[ $ Sheet2 . A1 : . B5 ]
*/
@ -234,7 +234,7 @@ namespace formulasconvert {
convert_with_TableName = withTableName;
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace(
expr,

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 \
@ -209,6 +210,8 @@ SOURCES += \
../src/odf/datatypes/wrapoption.cpp \
../src/odf/datatypes/writingmode.cpp \
../src/odf/datatypes/xlink.cpp \
../src/odf/datatypes/chartlabelposition.cpp \
../src/odf/datatypes/grandtotal.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -462,6 +465,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

@ -119,3 +119,5 @@
#include "../src/odf/datatypes/wrapoption.cpp"
#include "../src/odf/datatypes/writingmode.cpp"
#include "../src/odf/datatypes/xlink.cpp"
#include "../src/odf/datatypes/chartlabelposition.cpp"
#include "../src/odf/datatypes/grandtotal.cpp"

View File

@ -235,7 +235,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
outputPath = outputPath.substr(0, n_svm) + L".png";
}
//------------------------------------------------
if (inputFileName.empty()) return L"";
//if (inputFileName.empty()) return L""; - Book 27.ods - пустые линки на картинки
id = std::wstring(L"picId") + std::to_wstring(count_image + 1);
count_image++;

View File

@ -124,6 +124,7 @@ void oox_chart_series::parse_properties()
data_labels_->set_showCatName(*boolVal);
}
odf_reader::GetProperty(content_.properties_, L"data-label-number", intVal);
if (intVal)
{
if (!data_labels_) data_labels_ = oox_data_labels();
@ -131,6 +132,13 @@ void oox_chart_series::parse_properties()
if (*intVal == 1) data_labels_->set_showVal(true);
if (*intVal == 2) data_labels_->set_showPercent(true);
}
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal)
{
if (!data_labels_) data_labels_ = oox_data_labels();
data_labels_->set_position(*intVal);
}
}
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{

View File

@ -49,6 +49,8 @@ oox_data_labels::oox_data_labels()//подписи на значениях
showPercent_ = false;
showSerName_ = false;
showVal_ = false;
position_ = -1; //not set
}
void oox_data_labels::set_common_dLbl ( std::vector<odf_reader::_property> & text_properties)
@ -105,6 +107,29 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
}
}
}
if (position_ >= 0 && position_ < 13)
{
CP_XML_NODE(L"c:dLblPos")
{
switch (position_)
{
case 0: CP_XML_ATTR(L"val", L"bestFit");break;
case 1: CP_XML_ATTR(L"val", L"b"); break;
case 2: CP_XML_ATTR(L"val", L"b"); break;
case 3: CP_XML_ATTR(L"val", L"b"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
case 6: CP_XML_ATTR(L"val", L"l"); break;
case 7: CP_XML_ATTR(L"val", L"inBase"); break;
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
case 9: CP_XML_ATTR(L"val", L"r"); break;
case 10: CP_XML_ATTR(L"val", L"t"); break;
case 11: CP_XML_ATTR(L"val", L"t"); break;
case 12: CP_XML_ATTR(L"val", L"t"); break;
}
}
}
CP_XML_NODE(L"c:showLegendKey")
{

View File

@ -59,8 +59,10 @@ public:
void set_showSerName (bool Val){showSerName_ = Val;}
void set_showVal (bool Val){showVal_ = Val;}
void add_dLbl(int ind, std::vector<odf_reader::_property> & text_properties);
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
void set_position (int Val){position_ = Val;}
void add_dLbl (int ind, std::vector<odf_reader::_property> & text_properties);
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
private:
@ -72,6 +74,8 @@ private:
bool showSerName_; // (Show Series Name) §21.2.2.188
bool showVal_; // (Show Value) §21.2.2.189
int position_;
std::vector<odf_reader::_property> textPr_;
std::map<int, std::vector<odf_reader::_property>> dLbls_;

View File

@ -514,7 +514,7 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
}
void xlsx_drawing_context::process_image(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
{
if (!drawing.fill.bitmap)
{

View File

@ -0,0 +1,85 @@
/*
* (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 "chartlabelposition.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const chart_label_position & _Val)
{
switch(_Val.get_type())
{
case chart_label_position::avoid_overlap: _Wostream << L"avoid-overlap"; break;
case chart_label_position::bottom: _Wostream << L"bottom"; break;
case chart_label_position::bottom_left: _Wostream << L"bottom-left"; break;
case chart_label_position::bottom_right: _Wostream << L"bottom_right"; break;
case chart_label_position::center: _Wostream << L"center"; break;
case chart_label_position::inside: _Wostream << L"insidev"; break;
case chart_label_position::left: _Wostream << L"left"; break;
case chart_label_position::near_origin: _Wostream << L"near-origin"; break;
case chart_label_position::outside: _Wostream << L"outside"; break;
case chart_label_position::right: _Wostream << L"right"; break;
case chart_label_position::top: _Wostream << L"top"; break;
case chart_label_position::top_left: _Wostream << L"top-left"; break;
case chart_label_position::top_right: _Wostream << L"top-right"; break;
}
return _Wostream;
}
chart_label_position chart_label_position::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"avoid-overlap") return chart_label_position( avoid_overlap );
else if (tmp == L"bottom") return chart_label_position( bottom );
else if (tmp == L"bottom-left") return chart_label_position( bottom_left );
else if (tmp == L"bottom-right")return chart_label_position( bottom_right );
else if (tmp == L"center") return chart_label_position( center );
else if (tmp == L"inside") return chart_label_position( inside );
else if (tmp == L"left") return chart_label_position( left );
else if (tmp == L"near-origin") return chart_label_position( near_origin );
else if (tmp == L"outside") return chart_label_position( outside );
else if (tmp == L"right") return chart_label_position( right );
else if (tmp == L"top") return chart_label_position( top );
else if (tmp == L"top-left") return chart_label_position( top_left );
else if (tmp == L"top-right") return chart_label_position( top_right );
else
{
return chart_label_position( near_origin );
}
}
} }

View File

@ -0,0 +1,84 @@
/*
* (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 chart_label_position
{
public:
enum type
{
avoid_overlap,
bottom,
bottom_left,
bottom_right,
center,
inside,
left,
near_origin,
outside,
right,
top,
top_left,
top_right
};
chart_label_position() {}
chart_label_position(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static chart_label_position parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const chart_label_position & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_label_position);
}

View File

@ -62,7 +62,6 @@ chart_solid_type chart_solid_type::parse(const std::wstring & Str)
return chart_solid_type( pyramid );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_solid_type( cuboid );
}
}

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

@ -219,6 +219,15 @@ enum ElementType
typeTableTableRowGroup,
typeTableTableRowNoGroup,
typeTableTableSource,
typeTableDataPilotTables,
typeTableDataPilotTable,
typeTableDataPilotField,
typeTableDatabaseSourceTable,
typeTableDatabaseSourceQuery,
typeTableDatabaseSourceSql,
typeTableSourceCellRange,
typeTableSourceService,
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"
@ -52,6 +51,10 @@ void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstrin
{
CP_CREATE_ELEMENT(table_database_ranges_);
}
else if CP_CHECK_NAME(L"table", L"data-pilot-tables")
{
CP_CREATE_ELEMENT(table_data_pilot_tables_);
}
else
CP_CREATE_ELEMENT(content_);
}
@ -87,6 +90,10 @@ void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
for (size_t i = 0; i < table_data_pilot_tables_.size(); i++)
{
table_data_pilot_tables_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}

View File

@ -66,6 +66,7 @@ public:
// TODO: table-decls
office_element_ptr_array table_database_ranges_;
office_element_ptr_array table_data_pilot_tables_;
office_element_ptr tracked_changes_;//??
office_element_ptr_array content_;

View File

@ -151,6 +151,9 @@ void style_chart_properties::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"chart:error-category", strVal);
if (strVal)content_.push_back(_property(L"error-category", chart_error_category(chart_error_category::parse(strVal.get())).get_type() ));
CP_APPLY_ATTR(L"chart:label-position", strVal);
if (strVal)content_.push_back(_property(L"label-position", chart_label_position(chart_label_position::parse(strVal.get())).get_type() ));
common_rotation_angle_attlist_.add_attributes(Attributes);
//CP_APPLY_ATTR(L"chart:scale-text", chart_scale_text_ );

View File

@ -49,6 +49,7 @@
#include "datatypes/charterrorcategory.h"
#include "datatypes/chartseriessource.h"
#include "datatypes/chartregressiontype.h"
#include "datatypes/chartlabelposition.h"
#include "datatypes/direction.h"
namespace cpdoccore {

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"

View File

@ -0,0 +1,209 @@
/*
* (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_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_tables::xlsx_convert(oox::xlsx_conversion_context & Context)
{
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-filterbutton" , table_show_filterbutton_);
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)
{
CP_CREATE_ELEMENT (content_);
}
void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
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 )
{
}
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)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(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 )
{
}
void table_database_source_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_table::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_query::ns = L"table";
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 )
{
}
void table_database_source_query::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_query::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_database_source_sql::ns = L"table";
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 )
{
}
void table_database_source_sql::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_database_source_sql::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//-------------------------------------------------------------------------------------------------
const wchar_t * table_source_cell_range::ns = L"table";
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 )
{
}
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 )
{
}
void table_source_service::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT (content_);
}
void table_source_service::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
}
}

View File

@ -0,0 +1,227 @@
/*
* (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"
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_filterbutton_;
_CP_OPT(odf_types::Bool) table_show_target_range_address_;
office_element_ptr_array content_;
};
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);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_data_pilot_field);
//-------------------------------------------------------------------------------------
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);
office_element_ptr_array content_;
};
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);
office_element_ptr_array content_;
};
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);
office_element_ptr_array content_;
};
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);
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);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_source_service);
//-------------------------------------------------------------------------------------
}
}

View File

@ -385,6 +385,14 @@
RelativePath="..\src\odf\datatypes\chartlabelarrangement.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\chartlabelposition.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\chartlabelposition.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\chartregressiontype.cpp"
>
@ -557,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"
>

View File

@ -1659,6 +1659,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"
>

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)
@ -951,7 +961,7 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
{
odf_context()->drawing_context()->set_opacity_angle(oox_grad_fill->lin->ang.get()/60000.);
}
else if (oox_grad_fill->path.is_init())
else if (oox_grad_fill->path.is_init() && oox_grad_fill->path->rect.is_init())
{
odf_context()->drawing_context()->set_opacity_rect ( XmlUtils::GetInteger(oox_grad_fill->path->rect->l.get_value_or(L"")),
XmlUtils::GetInteger(oox_grad_fill->path->rect->t.get_value_or(L"")),
@ -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

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

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

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

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

@ -94,5 +94,6 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = convert_single(argv[1]);
//HRESULT hr = convert_directory(argv[1]);
return hr;
}

View File

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

View File

@ -31,7 +31,7 @@
*/
#include "BookExt.h"
#include <Logic/Biff_structures/FrtHeader.h>
#include "../Biff_structures/FrtHeader.h"
namespace XLS
{

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

@ -80,7 +80,7 @@ int Legend::serialize(std::wostream & _stream, int size)
{
CP_XML_NODE(L"c:legendPos")
{
if (y1Kf > 0.5)
if (y1Kf > 0.5 && y1Kf > x1Kf)
{
CP_XML_ATTR(L"val", "b");
x = x - (size - 1 ) * dx / 2;
@ -92,7 +92,7 @@ int Legend::serialize(std::wostream & _stream, int size)
y = y - (size - 1 ) * dy / 2;
dy = dy * size;
}
else if (x2Kf > 0.5)
else if (x2Kf > 0.5 && x2Kf > y2Kf)
{
CP_XML_ATTR(L"val", "l");
y = y - (size - 1 ) * dy / 2;

View File

@ -39,12 +39,10 @@ OleDbConn::OleDbConn()
{
}
OleDbConn::~OleDbConn()
{
}
BaseObjectPtr OleDbConn::clone()
{
return BaseObjectPtr(new OleDbConn(*this));
@ -52,9 +50,12 @@ BaseObjectPtr OleDbConn::clone()
void OleDbConn::readFields(CFRecord& record)
{
Log::error("OleDbConn record is not implemented.");
unsigned short flags;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
record >> frtHeaderOld >> flags >> cst;
fPasswd = GETBIT(flags, 0);
fLocal = GETBIT(flags, 1);
}
} // namespace XLS

View File

@ -32,12 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include "../Biff_structures/FrtHeaderOld.h"
namespace XLS
{
// Logical representation of OleDbConn record in BIFF8
class OleDbConn: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(OleDbConn)
@ -47,12 +46,15 @@ public:
~OleDbConn();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeOleDbConn;
static const ElementType type = typeOleDbConn;
FrtHeaderOld frtHeaderOld;
bool fPasswd;
bool fLocal;
unsigned short cst;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ PivotChartBits::PivotChartBits()
{
}
PivotChartBits::~PivotChartBits()
{
}
BaseObjectPtr PivotChartBits::clone()
{
return BaseObjectPtr(new PivotChartBits(*this));
@ -52,8 +50,10 @@ BaseObjectPtr PivotChartBits::clone()
void PivotChartBits::readFields(CFRecord& record)
{
Log::error("PivotChartBits record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
unsigned short unused1, flags, reserved1, reserved2, reserved3;
record >> rt >> unused1 >> flags >> reserved1 >> reserved2 >> reserved3;
fGXHide = GETBIT(flags, 0);
}
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PivotChartBits record in BIFF8
class PivotChartBits: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(PivotChartBits)
@ -47,12 +45,13 @@ public:
~PivotChartBits();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typePivotChartBits;
static const ElementType type = typePivotChartBits;
unsigned short rt;
bool fGXHide;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ Qsi::Qsi()
{
}
Qsi::~Qsi()
{
}
BaseObjectPtr Qsi::clone()
{
return BaseObjectPtr(new Qsi(*this));
@ -52,9 +50,30 @@ BaseObjectPtr Qsi::clone()
void Qsi::readFields(CFRecord& record)
{
Log::error("Qsi record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
unsigned short flags1, flags2;
_UINT32 reserved;
record >> flags1 >> itblAutoFmt >> flags2 >> reserved >> rgchName;
fTitles = GETBIT(flags1, 0);
fRowNums = GETBIT(flags1, 1);
fDisableRefresh = GETBIT(flags1, 2);
fAsync = GETBIT(flags1, 3);
fNewAsync = GETBIT(flags1, 4);
fAutoRefresh = GETBIT(flags1, 5);
fShrink = GETBIT(flags1, 6);
fFill = GETBIT(flags1, 7);
fAutoFormat = GETBIT(flags1, 8);
fSaveData = GETBIT(flags1, 9);
fDisableEdit = GETBIT(flags1, 10);
fOverwrite = GETBIT(flags1, 13);
fibitAtrNum = GETBIT(flags2, 0);
fibitAtrFnt = GETBIT(flags2, 1);
fibitAtrAlc = GETBIT(flags2, 2);
fibitAtrBdr = GETBIT(flags2, 3);
fibitAtrPat = GETBIT(flags2, 4);
fibitAtrProt = GETBIT(flags2, 5);
}
} // namespace XLS

View File

@ -32,12 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include "../Biff_structures/BiffString.h"
namespace XLS
{
// Logical representation of Qsi record in BIFF8
class Qsi: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Qsi)
@ -47,11 +46,31 @@ public:
~Qsi();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeQsi;
static const ElementType type = typeQsi;
bool fTitles;
bool fRowNums;
bool fDisableRefresh;
bool fAsync;
bool fNewAsync;
bool fAutoRefresh;
bool fShrink;
bool fFill;
bool fAutoFormat;
bool fSaveData;
bool fDisableEdit;
bool fOverwrite;
unsigned short itblAutoFmt; //AutoFmt8
bool fibitAtrNum;
bool fibitAtrFnt;
bool fibitAtrAlc;
bool fibitAtrBdr;
bool fibitAtrPat;
bool fibitAtrProt;
XLUnicodeString rgchName;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ Qsif::Qsif()
{
}
Qsif::~Qsif()
{
}
BaseObjectPtr Qsif::clone()
{
return BaseObjectPtr(new Qsif(*this));
@ -52,8 +50,22 @@ BaseObjectPtr Qsif::clone()
void Qsif::readFields(CFRecord& record)
{
Log::error("Qsif record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
unsigned short flags1, flags2;
record >> frtHeaderOld >> flags1 >> flags2 >> idField;
fUserIns = GETBIT(flags1, 0);
fFillDown = GETBIT(flags1, 1);
fSortDes = GETBIT(flags1, 2);
iSortKey = GETBITS(flags1, 3, 10);
fRowNums = GETBIT(flags1, 11);
fSorted = GETBIT(flags1, 13);
fClipped = GETBIT(flags2, 0);
if (record.getRdPtr() >= record.getDataSize())
return;
record >> idList >> rgbTitle;
}
} // namespace XLS

View File

@ -32,12 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include "../Biff_structures/FrtHeaderOld.h"
#include "../Biff_structures/BiffString.h"
namespace XLS
{
// Logical representation of Qsif record in BIFF8
class Qsif: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Qsif)
@ -47,12 +47,22 @@ public:
~Qsif();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeQsif;
static const ElementType type = typeQsif;
FrtHeaderOld frtHeaderOld;
bool fUserIns;
bool fFillDown;
bool fSortDes;
unsigned char iSortKey;
bool fRowNums;
bool fSorted;
bool fClipped;
_UINT32 idField;
_UINT32 idList;
XLUnicodeString rgbTitle;
};
} // namespace XLS

View File

@ -187,6 +187,27 @@ void SXAddl_SXCView_SXDId::readFields(CFRecord& record)
record >> stName;
}
//----------------------------------------------------------------------------
BaseObjectPtr SXAddl_SXCCacheField_SXDIfdbMempropMap::clone()
{
return BaseObjectPtr(new SXAddl_SXCCacheField_SXDIfdbMempropMap(*this));
}
void SXAddl_SXCCacheField_SXDIfdbMempropMap::readFields(CFRecord& record)
{
m_SXAddlHdr.load(record);
record.skipNunBytes(6);
int sz = record.getDataSize() - record.getRdPtr();
for (int i = 0; i < sz/2; i++)
{
unsigned short val;
record >> val;
rgMap.push_back(val);
}
}
} // namespace XLS

View File

@ -159,7 +159,14 @@ public:
class SXAddl_SXCCacheField_SXDCaption : public SXAddl {};
class SXAddl_SXCCacheField_SXDEnd : public SXAddl {};
class SXAddl_SXCCacheField_SXDId : public SXAddl {};
class SXAddl_SXCCacheField_SXDIfdbMempropMap: public SXAddl {};
class SXAddl_SXCCacheField_SXDIfdbMempropMap: public SXAddl
{
public:
virtual void readFields(CFRecord& record);
virtual BaseObjectPtr clone();
std::vector<unsigned short> rgMap;
};
class SXAddl_SXCCacheField_SXDIfdbMpMapCount: public SXAddl {};
class SXAddl_SXCCacheField_SXDProperty : public SXAddl {};
class SXAddl_SXCCacheField_SXDPropName : public SXAddl {};

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

@ -49,11 +49,10 @@ public:
virtual void load(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref = false);
ExtSheetPair iTabs;
RgceAreaRel area;
ExtSheetPair iTabs;
RgceAreaRel area;
const CellRef& cell_base_ref;
};

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,11 +97,11 @@ 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());
}
else
else if (posBlob < dbb->size)
{
if (arPivotCacheFieldShortSize[i])//fShortIitms
{

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,17 +189,21 @@ int FDB::serialize(std::wostream & strm)
CP_XML_NODE(L"cacheField")
{
CP_XML_ATTR(L"name", fdb->stFieldName.value());
if (fdb_type->wTypeSql > 0)
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);
//CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql); //in db
}
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
{
CP_XML_ATTR(L"databaseField", 0);
}
switch(fdb_type->wTypeSql)//format code
{
case 0x0000:
@ -250,6 +254,7 @@ int FDB::serialize(std::wostream & strm)
if (bNumber) bInteger = false;
else bNumber = true;
}
if ((bDate & bNumber) || (bNumber & bString))
{
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
@ -262,13 +267,19 @@ int FDB::serialize(std::wostream & strm)
{
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
}
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bDate && ! (bNumber || bInteger || bString || bEmpty ))
{
CP_XML_ATTR(L"containsNonDate", 0);
}
if (bDate) CP_XML_ATTR(L"containsDate", 1);
if (!bString && (bInteger || bDate || bNumber || bEmpty))
{
CP_XML_ATTR(L"containsString", 0);
}
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
if (!bString && (bInteger || bDate || bNumber || bEmpty))
CP_XML_ATTR(L"containsString", 0);
if (fdb->fnumMinMaxValid)
{
@ -296,8 +307,13 @@ int FDB::serialize(std::wostream & strm)
{
CP_XML_NODE(L"fieldGroup")
{
if (fdb->ifdbParent > 0)
if (fdb->fHasParent)
{
CP_XML_ATTR(L"par", fdb->ifdbParent);
CP_XML_ATTR(L"base", index);
}
else
CP_XML_ATTR(L"base", fdb->ifdbBase);
if (m_SXRANGE)
m_SXRANGE->serialize(CP_XML_STREAM());

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;
@ -67,7 +67,8 @@ public:
bool bInteger;
bool bBool;
GlobalWorkbookInfoPtr global_info;
int index;
GlobalWorkbookInfoPtr global_info;
};
} // namespace XLS

View File

@ -91,9 +91,13 @@ const bool PIVOTCACHE::loadContent(BinProcessor& proc)
}
count = proc.repeated<FDB>(0, 0);
int i = 0;
while(count--)
{
m_arFDB.push_back(elements_.front()); elements_.pop_front();
FDB* fdb = dynamic_cast<FDB*>(m_arFDB.back().get());
fdb->index = i++;
}
count = proc.repeated<DBB>(0, 0);

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>())
{
@ -98,9 +106,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"name", view->stTable.value());
CP_XML_ATTR(L"cacheId", view->iCache);
CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
@ -111,15 +117,16 @@ int PIVOTVIEW::serialize(std::wostream & strm)
{
CP_XML_ATTR(L"dataCaption", view->stData.value());
}
//updatedVersion="2"
//asteriskTotals="1"
//showMemberPropertyTips="0"
//itemPrintTitles="1"
//createdVersion="1"
//indent="0"
//compact="0"
//compactData="0"
//gridDropZones="1"
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());
@ -186,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
{
@ -82,7 +84,10 @@ const bool SXOPER::loadContent(BinProcessor& proc)
}
bNumber = !bInteger;
node = L"n";
value = std::to_wstring(num->num.data.value);
if (bInteger)
value = std::to_wstring((int)num->num.data.value);
else
value = boost::lexical_cast<std::wstring>(num->num.data.value);
}
else if(proc.optional<SxBool>())
{
@ -130,7 +135,7 @@ int SXOPER::serialize(std::wostream & strm)
{
CP_XML_NODE(node)
{
if (!value.empty())
if (!value.empty() || bString)
{
CP_XML_ATTR(L"v", value);
}

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"
@ -202,10 +203,30 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
proc.optional<PROTECTION_COMMON>(); break;
case rt_Palette: proc.optional<Palette>(); break;
case rt_SXViewLink: proc.optional<SXViewLink>(); break;
case rt_PivotChartBits: proc.optional<PivotChartBits>(); break;
case rt_SBaseRef: proc.optional<SBaseRef>(); break;
case rt_SXViewLink:
{
if (proc.optional<SXViewLink>())
{
m_SXViewLink = elements_.back();
elements_.pop_back();
}
}break;
case rt_PivotChartBits:
{
if (proc.optional<PivotChartBits>())
{
m_PivotChartBits = elements_.back();
elements_.pop_back();
}
}break;
case rt_SBaseRef:
{
if (proc.optional<SBaseRef>())
{
m_SBaseRef = elements_.back();
elements_.pop_back();
}
}break;
case rt_Obj:
case rt_MsoDrawing:
{
@ -224,9 +245,18 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{
if (proc.optional<ExternSheet>())
{
m_ExternSheet = elements_.back();
elements_.pop_back();
}
}break;
case rt_Units: proc.mandatory<Units>(); break;
case rt_Units:
{
if (proc.mandatory<Units>())
{
m_Units = elements_.back();
elements_.pop_back();
}
}break;
case rt_Chart:
{
if ( proc.mandatory<CHARTFORMATS>() )
@ -348,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());
@ -368,7 +397,26 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
if ((chart_area_format) && (chart_area_format->fInvertNeg)) CP_XML_ATTR(L"val", 1); //????
else CP_XML_ATTR(L"val", 0);
}
if (m_SXViewLink)
{
SXViewLink *link = dynamic_cast<SXViewLink*>(m_SXViewLink.get());
CP_XML_NODE(L"c:pivotSource")
{
CP_XML_NODE(L"c:name")
{
std::wstring name = link->stPivotTable.value();
std::wstring::size_type pos = name.find(L"]");
if (std::wstring::npos != pos)
name = L"[]" + name.substr(pos + 1);
CP_XML_STREAM() << name;
}
CP_XML_NODE(L"c:fmtId")
{
CP_XML_ATTR(L"val", 0);
}
}
}
CP_XML_NODE(L"c:chart")
{
serialize_title (CP_XML_STREAM());
@ -405,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)
@ -685,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;
@ -718,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)
{
@ -729,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

@ -75,6 +75,12 @@ public:
BaseObjectPtr m_OBJECTSCHART;
std::vector<BaseObjectPtr> m_arWINDOW;
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);
@ -82,10 +88,7 @@ private:
std::map<int, std::vector<int>> m_mapTypeChart;//тут нужен несортированый .. пока оставим этот
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
};
} // namespace XLS

View File

@ -31,48 +31,49 @@
*/
#include "WorksheetSubstream.h"
#include <Logic/Biff_records/Uncalced.h>
#include <Logic/Biff_records/Index.h>
#include <Logic/Biff_unions/GLOBALS.h>
#include <Logic/Biff_unions/PAGESETUP.h>
#include <Logic/Biff_records/Dimensions.h>
#include <Logic/Biff_records/HFPicture.h>
#include <Logic/Biff_records/Note.h>
#include <Logic/Biff_records/DxGCol.h>
#include <Logic/Biff_records/MergeCells.h>
#include <Logic/Biff_records/LRng.h>
#include <Logic/Biff_records/CodeName.h>
#include <Logic/Biff_records/WebPub.h>
#include <Logic/Biff_records/Window1.h>
#include <Logic/Biff_records/CellWatch.h>
#include <Logic/Biff_records/SheetExt.h>
#include <Logic/Biff_records/EOF.h>
#include <Logic/Biff_records/BOF.h>
#include <Logic/Biff_records/DefaultRowHeight.h>
#include <Logic/Biff_records/Label.h>
#include <Logic/Biff_unions/BACKGROUND.h>
#include <Logic/Biff_unions/BIGNAME.h>
#include <Logic/Biff_unions/PROTECTION_COMMON.h>
#include <Logic/Biff_unions/COLUMNS.h>
#include <Logic/Biff_unions/SCENARIOS.h>
#include <Logic/Biff_unions/SORTANDFILTER.h>
#include <Logic/Biff_unions/CELLTABLE.h>
#include <Logic/Biff_unions/OBJECTS.h>
#include <Logic/Biff_unions/PIVOTVIEW.h>
#include <Logic/Biff_unions/DCON.h>
#include <Logic/Biff_unions/WINDOW.h>
#include <Logic/Biff_unions/CUSTOMVIEW.h>
#include <Logic/Biff_unions/SORT.h>
#include <Logic/Biff_unions/QUERYTABLE.h>
#include <Logic/Biff_unions/PHONETICINFO.h>
#include <Logic/Biff_unions/CONDFMTS.h>
#include <Logic/Biff_unions/HLINK.h>
#include <Logic/Biff_unions/DVAL.h>
#include <Logic/Biff_unions/FEAT.h>
#include <Logic/Biff_unions/FEAT11.h>
#include <Logic/Biff_unions/RECORD12.h>
#include <Logic/Biff_unions/SHFMLA_SET.h>
#include "Biff_records/Uncalced.h"
#include "Biff_records/Index.h"
#include "Biff_unions/GLOBALS.h"
#include "Biff_unions/PAGESETUP.h"
#include "Biff_records/Dimensions.h"
#include "Biff_records/HFPicture.h"
#include "Biff_records/Note.h"
#include "Biff_records/DxGCol.h"
#include "Biff_records/MergeCells.h"
#include "Biff_records/LRng.h"
#include "Biff_records/CodeName.h"
#include "Biff_records/WebPub.h"
#include "Biff_records/Window1.h"
#include "Biff_records/CellWatch.h"
#include "Biff_records/SheetExt.h"
#include "Biff_records/EOF.h"
#include "Biff_records/BOF.h"
#include "Biff_records/DefaultRowHeight.h"
#include "Biff_records/Label.h"
#include "Biff_unions/BACKGROUND.h"
#include "Biff_unions/BIGNAME.h"
#include "Biff_unions/PROTECTION_COMMON.h"
#include "Biff_unions/COLUMNS.h"
#include "Biff_unions/SCENARIOS.h"
#include "Biff_unions/SORTANDFILTER.h"
#include "Biff_unions/CELLTABLE.h"
#include "Biff_unions/OBJECTS.h"
#include "Biff_unions/PIVOTVIEW.h"
#include "Biff_unions/DCON.h"
#include "Biff_unions/WINDOW.h"
#include "Biff_unions/CUSTOMVIEW.h"
#include "Biff_unions/SORT.h"
#include "Biff_unions/QUERYTABLE.h"
#include "Biff_unions/PHONETICINFO.h"
#include "Biff_unions/CONDFMTS.h"
#include "Biff_unions/HLINK.h"
#include "Biff_unions/DVAL.h"
#include "Biff_unions/FEAT.h"
#include "Biff_unions/FEAT11.h"
#include "Biff_unions/RECORD12.h"
#include "Biff_unions/SHFMLA_SET.h"
#include "Biff_structures/ODRAW/OfficeArtDgContainer.h"
@ -292,6 +293,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
m_arPIVOTVIEW.insert(m_arPIVOTVIEW.begin(), elements_.back());
elements_.pop_back();
count--;
PIVOTVIEW *view = dynamic_cast<PIVOTVIEW*>(m_arPIVOTVIEW.back().get());
mapPivotViews.insert(std::make_pair(view->name, m_arPIVOTVIEW.back()));
}
}break;
case rt_DCon:

View File

@ -90,6 +90,9 @@ public:
std::vector<BiffStructurePtr> m_arHFPictureDrawing;
//-------------------------------------------------------------------
std::map<std::wstring, BaseObjectPtr> mapPivotViews;
private:
void LoadHFPicture(); //todoooo - обобщить

View File

@ -357,7 +357,11 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
xls_global_info->current_sheet = -1;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + std::to_wstring(count_chart_sheets));
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
xlsx_context->set_chart_view();
XLS::ChartSheetSubstream* chart = dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get());
convert_chart_sheet(chart);
}
xlsx_context->end_table();
@ -369,7 +373,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
}
}
void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
{
if (sheet == NULL) return;

View File

@ -104,6 +104,13 @@ bool xlsx_conversion_context::start_table(const std::wstring & name)
return true;
}
void xlsx_conversion_context::set_chart_view()
{
if (sheets_.empty()) return;
get_table_context().set_chart_view();
}
void xlsx_conversion_context::set_state(const std::wstring & state)
{
if (state.empty()) return;

View File

@ -66,6 +66,7 @@ public:
bool start_table(const std::wstring & name);
void set_state(const std::wstring & state);
void set_chart_view();
void end_table();
void start_chart();

View File

@ -61,6 +61,21 @@ void xlsx_table_context::start_table(const std::wstring & name)
tables_state_.push_back( table_state_ptr(new table_state(context_)));
}
void xlsx_table_context::set_chart_view()
{
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
}
void xlsx_table_context::end_table()
{
if (!get_drawing_context().empty())

View File

@ -60,6 +60,7 @@ public:
public:
void start_table(const std::wstring & name);
void set_chart_view();
void end_table();
xlsx_drawing_context & get_drawing_context();

0
Common/3dParty/openssl/build.sh Normal file → Executable file
View File

0
Common/3dParty/openssl/fetch.sh Normal file → Executable file
View File

View File

@ -213,6 +213,7 @@
690FE07F1E9BBA15004B26D0 /* DrawingExt.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE07B1E9BBA15004B26D0 /* DrawingExt.h */; };
690FE0821E9BBA23004B26D0 /* DiagramData.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0801E9BBA23004B26D0 /* DiagramData.h */; };
690FE0831E9BBA23004B26D0 /* DiagramDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */; };
691C3E131F20C3D500F1775E /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 691C3E121F20C3D500F1775E /* File.cpp */; };
69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; };
/* End PBXBuildFile section */
@ -431,6 +432,7 @@
690FE07B1E9BBA15004B26D0 /* DrawingExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingExt.h; sourceTree = "<group>"; };
690FE0801E9BBA23004B26D0 /* DiagramData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramData.h; sourceTree = "<group>"; };
690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramDrawing.h; sourceTree = "<group>"; };
691C3E121F20C3D500F1775E /* File.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = File.cpp; sourceTree = "<group>"; };
69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -901,6 +903,7 @@
17E6B3BD1AC4298500F28F8B /* Base64.h */,
17E6B3BE1AC4298500F28F8B /* Directory.h */,
17E6B3BF1AC4298500F28F8B /* File.h */,
691C3E121F20C3D500F1775E /* File.cpp */,
17E6B3C01AC4298500F28F8B /* Path.h */,
17E6B3C11AC4298500F28F8B /* Types.h */,
69F181EA1C7734A700B2952B /* strings_hack_printf.h */,
@ -1163,6 +1166,7 @@
17C1FBAE1ACC4250006B99B3 /* oMath.cpp in Sources */,
17C1FBAF1ACC4250006B99B3 /* ChartSerialize.cpp in Sources */,
17C1FBB11ACC4250006B99B3 /* Position.cpp in Sources */,
691C3E131F20C3D500F1775E /* File.cpp in Sources */,
17C1FBB21ACC4250006B99B3 /* Vml.cpp in Sources */,
17C1FBB31ACC4250006B99B3 /* unicode_util.cpp in Sources */,
17C1FBB41ACC4250006B99B3 /* FldSimple.cpp in Sources */,
@ -1202,6 +1206,7 @@
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -1242,6 +1247,7 @@
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -37,7 +37,7 @@
#include "unicode_util.h"
#include "../../../DesktopEditor/common/File.h"
#include "../../../../DesktopEditor/common/File.h"
#define _T(x) __T(x)
#define __T(x) L##x

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