mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-17 13:02:41 +08:00
Compare commits
10 Commits
core-win-6
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 028e58ad51 | |||
| 424e0e34cc | |||
| d8988cd101 | |||
| 440a884c0a | |||
| 449bab1a70 | |||
| c1e5e33691 | |||
| 8c7515443a | |||
| 1d16f4ab8f | |||
| 122a5cd056 | |||
| b0994759e7 |
@ -687,6 +687,7 @@ void common_shape_draw_attlist::add_attributes( const xml::attributes_wc_ptr & A
|
||||
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
|
||||
CP_APPLY_ATTR(L"draw:name", draw_name_);
|
||||
CP_APPLY_ATTR(L"draw:text-style-name", draw_text_style_name_);
|
||||
CP_APPLY_ATTR(L"drawooo:display", drawooo_display_);
|
||||
}
|
||||
void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Other)
|
||||
{
|
||||
@ -698,6 +699,7 @@ void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Oth
|
||||
_CP_APPLY_PROP2(draw_transform_);
|
||||
_CP_APPLY_PROP2(draw_name_);
|
||||
_CP_APPLY_PROP2(draw_text_style_name_);
|
||||
_CP_APPLY_PROP2(drawooo_display_);
|
||||
}
|
||||
|
||||
void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
|
||||
@ -710,6 +712,7 @@ void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
|
||||
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:display", drawooo_display_);
|
||||
}
|
||||
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
|
||||
@ -501,6 +501,7 @@ public:
|
||||
_CP_OPT(std::wstring) draw_layer_;
|
||||
_CP_OPT(std::wstring) draw_transform_;
|
||||
_CP_OPT(int) draw_z_index_;
|
||||
_CP_OPT(std::wstring) drawooo_display_;
|
||||
};
|
||||
|
||||
class common_draw_position_attlist
|
||||
|
||||
@ -384,9 +384,11 @@ void odf_drawing_context::start_group()
|
||||
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
|
||||
if (impl_->current_drawing_state_.z_order_ >= 0)
|
||||
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
|
||||
if (!impl_->current_drawing_state_.name_.empty())
|
||||
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
|
||||
|
||||
//if (!impl_->current_drawing_state_.description_.empty())
|
||||
// group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.description_;
|
||||
if (impl_->current_drawing_state_.hidden_)
|
||||
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
|
||||
|
||||
impl_->current_drawing_state_.name_ = L"";
|
||||
impl_->current_drawing_state_.z_order_ = -1;
|
||||
|
||||
@ -519,10 +521,12 @@ void odf_drawing_context::end_drawing()
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_class_ = impl_->current_drawing_state_.presentation_class_;
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_layer_ = draw_layer;
|
||||
}
|
||||
if (impl_->current_drawing_state_.name_.length() > 0)
|
||||
if (!impl_->current_drawing_state_.name_.empty())
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
|
||||
if (impl_->current_drawing_state_.z_order_ >= 0)
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
|
||||
if (impl_->current_drawing_state_.hidden_)
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
|
||||
|
||||
std::wstring strTransform;
|
||||
|
||||
@ -2125,6 +2129,13 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
|
||||
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
|
||||
|
||||
}
|
||||
void odf_drawing_context::set_textarea_fit_to_size(bool val)
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
|
||||
impl_->current_graphic_properties->draw_fit_to_size_ = val;
|
||||
}
|
||||
|
||||
|
||||
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
|
||||
{
|
||||
|
||||
@ -228,6 +228,7 @@ public:
|
||||
void set_textarea_wrap (bool val);
|
||||
void set_textarea_fontcolor (std::wstring hexColor);
|
||||
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
|
||||
void set_textarea_fit_to_size (bool val);
|
||||
|
||||
void set_placeholder_id (std::wstring val);
|
||||
void set_placeholder_type (int val);
|
||||
|
||||
@ -1137,12 +1137,24 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
//+ style section
|
||||
//+element text:section в котором параграфы
|
||||
}
|
||||
if (oox_bodyPr->Fit.type == PPTX::Logic::TextFit::FitSpAuto)
|
||||
{
|
||||
//изменяемы размеры
|
||||
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
|
||||
|
||||
switch(oox_bodyPr->Fit.type)
|
||||
{
|
||||
case PPTX::Logic::TextFit::FitSpAuto:
|
||||
{//изменяемы размеры
|
||||
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
|
||||
}break;
|
||||
case PPTX::Logic::TextFit::FitNo:
|
||||
{
|
||||
}break;
|
||||
case PPTX::Logic::TextFit::FitNormAuto:
|
||||
{
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
|
||||
@ -1436,6 +1436,8 @@ void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
|
||||
|
||||
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
|
||||
{
|
||||
pShape->FillLevelUp();
|
||||
|
||||
int type = 0;
|
||||
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
|
||||
type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
@ -92,13 +92,16 @@ public:
|
||||
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
|
||||
|
||||
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
|
||||
m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt;
|
||||
|
||||
if (bResult == false)
|
||||
{
|
||||
delete pInfo;
|
||||
|
||||
if (pInfo->m_bEncrypt) return false;
|
||||
else continue;
|
||||
if (pInfo->m_bEncrypt)
|
||||
return false;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
m_arUsers.push_back(pInfo);
|
||||
|
||||
@ -116,7 +116,7 @@ bool CPPTFileReader::ReadPersists()
|
||||
CFStreamPtr pStream = GetDocumentStream();
|
||||
if (!pStream) return false;
|
||||
|
||||
if (m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, pStream->stream_) == false) return false;
|
||||
return m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, pStream->stream_);
|
||||
}
|
||||
void CPPTFileReader::ReadDocument()
|
||||
{
|
||||
|
||||
@ -60,7 +60,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
pptFile.put_TempDirectory(tempPath);
|
||||
|
||||
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"password");
|
||||
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"");
|
||||
|
||||
if (hRes == S_OK)
|
||||
{
|
||||
|
||||
@ -128,27 +128,32 @@ namespace PPTX
|
||||
{
|
||||
if (!pShape) return;
|
||||
|
||||
if(pShape->nvSpPr.nvPr.ph.is_init())
|
||||
if (pShape->nvSpPr.nvPr.ph.is_init())
|
||||
{
|
||||
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
|
||||
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
|
||||
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(L"");
|
||||
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(L"body");
|
||||
|
||||
if(type == L"ctrTitle") type = L"title";
|
||||
if (type == L"ctrTitle") type = L"title";
|
||||
|
||||
for(size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
|
||||
for (size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
|
||||
{
|
||||
smart_ptr<Logic::Shape> pLayoutShape = cSld.spTree.SpTreeElems[i].GetElem().smart_dynamic_cast<Logic::Shape>();
|
||||
|
||||
if(pLayoutShape.IsInit())
|
||||
if (pLayoutShape.IsInit())
|
||||
{
|
||||
if(pLayoutShape->nvSpPr.nvPr.ph.is_init())
|
||||
if (pLayoutShape->nvSpPr.nvPr.ph.is_init())
|
||||
{
|
||||
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
|
||||
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T(""));
|
||||
std::wstring lType = pLayoutShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
|
||||
|
||||
if(lType == _T("ctrTitle")) lType = _T("title");
|
||||
if (lType == L"ctrTitle") lType = L"title";
|
||||
|
||||
if((type == lType) && (idx == lIdx))
|
||||
if ((type == lType) && (idx == lIdx) && !idx.empty())
|
||||
{
|
||||
pShape->SetLevelUpElement(pLayoutShape.operator->());
|
||||
return;
|
||||
}
|
||||
else if ((type == lType) && idx.empty() && lIdx.empty())
|
||||
{
|
||||
pShape->SetLevelUpElement(pLayoutShape.operator->());
|
||||
return;
|
||||
|
||||
@ -66,7 +66,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
|
||||
{
|
||||
CFRecordType::TypeString rec_name = records_cache.front()->getTypeString();
|
||||
|
||||
Log::warning(rec_name);
|
||||
//Log::warning(rec_name);
|
||||
|
||||
if (desirable_type == rt_MsoDrawingGroup) // объединяем rt_MsoDrawingGroup + rt_Continue в один блок
|
||||
{
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of BkHim record in BIFF8
|
||||
class BkHim: public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(BkHim)
|
||||
@ -48,10 +46,9 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeBkHim;
|
||||
static const ElementType type = typeBkHim;
|
||||
|
||||
_UINT16 cf;
|
||||
_UINT32 lcb;
|
||||
|
||||
@ -52,8 +52,24 @@ BaseObjectPtr SXDBB::clone()
|
||||
|
||||
void SXDBB::readFields(CFRecord& record)
|
||||
{
|
||||
int skip = record.getDataSize() - record.getRdPtr();
|
||||
record.skipNunBytes(skip);
|
||||
unsigned int sz = record.getDataSize() - record.getRdPtr();
|
||||
|
||||
//std::list<CFRecordPtr>& recs = continue_records[rt_Continue];
|
||||
|
||||
//while (record.getRdPtr() + lcb > record.getDataSize() && !recs.empty())
|
||||
//{
|
||||
// record.appendRawData(recs.front());
|
||||
// recs.pop_front();
|
||||
//}
|
||||
|
||||
if (record.checkFitReadSafe(sz))
|
||||
{
|
||||
blob = boost::shared_array<char>(new char[sz]);
|
||||
|
||||
memcpy(blob.get(), record.getCurData<char>(), sz);
|
||||
|
||||
record.skipNunBytes(sz);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,12 +31,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "BiffRecordContinued.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class SXDBB: public BiffRecord
|
||||
class SXDBB: public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(SXDBB)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(SXDBB)
|
||||
@ -50,6 +50,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSXDBB;
|
||||
|
||||
boost::shared_array<char> blob;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,7 @@ BaseObjectPtr SXDtr::clone()
|
||||
|
||||
void SXDtr::readFields(CFRecord& record)
|
||||
{
|
||||
record >> yr >> mon >> dom >> hr >> min >> sec;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,12 @@ public:
|
||||
|
||||
static const ElementType type = typeSXDtr;
|
||||
|
||||
unsigned short yr;
|
||||
unsigned short mon;
|
||||
unsigned char dom;
|
||||
unsigned char hr;
|
||||
unsigned char min;
|
||||
unsigned char sec;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ BaseObjectPtr SXFDBType::clone()
|
||||
|
||||
void SXFDBType::readFields(CFRecord& record)
|
||||
{
|
||||
record >> wTypeSql;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSXFDBType;
|
||||
|
||||
|
||||
short wTypeSql; //ODBCType enum
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,7 @@ BaseObjectPtr SXInt::clone()
|
||||
|
||||
void SXInt::readFields(CFRecord& record)
|
||||
{
|
||||
record >> num;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,7 +50,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSXInt;
|
||||
|
||||
|
||||
short num;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,7 @@ BaseObjectPtr SXNum::clone()
|
||||
|
||||
void SXNum::readFields(CFRecord& record)
|
||||
{
|
||||
record >> num;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
#include "../Biff_structures/Xnum.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,7 +51,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSXNum;
|
||||
|
||||
|
||||
Xnum num;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,13 @@ BaseObjectPtr SXPair::clone()
|
||||
|
||||
void SXPair::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short reserved1, flags;
|
||||
|
||||
record >> isxvd >> iCache >> reserved1 >> flags;
|
||||
|
||||
fFormula = GETBIT(flags, 0);
|
||||
fPhysical = GETBIT(flags, 3);
|
||||
fRelative = GETBIT(flags, 4);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,7 +51,12 @@ public:
|
||||
|
||||
static const ElementType type = typeSXPair;
|
||||
|
||||
unsigned short isxvd;
|
||||
short iCache;
|
||||
|
||||
bool fFormula;
|
||||
bool fPhysical;
|
||||
bool fRelative;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,13 @@ BaseObjectPtr SXRng::clone()
|
||||
|
||||
void SXRng::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
|
||||
record >> flags;
|
||||
|
||||
fAutoStart = GETBIT(flags, 0);
|
||||
fAutoEnd = GETBIT(flags, 1);
|
||||
iByType = GETBITS(flags, 2, 4);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,7 +51,9 @@ public:
|
||||
|
||||
static const ElementType type = typeSXRng;
|
||||
|
||||
|
||||
bool fAutoStart;
|
||||
bool fAutoEnd;
|
||||
unsigned char iByType;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,10 @@ BaseObjectPtr SxBool::clone()
|
||||
|
||||
void SxBool::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
|
||||
val = (flags != 0);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,7 +50,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSxBool;
|
||||
|
||||
|
||||
bool val;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,7 @@ BaseObjectPtr SxErr::clone()
|
||||
|
||||
void SxErr::readFields(CFRecord& record)
|
||||
{
|
||||
record >> wbe;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSxErr;
|
||||
|
||||
|
||||
unsigned short wbe;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -52,57 +52,7 @@ BaseObjectPtr SxFmla::clone()
|
||||
|
||||
void SxFmla::readFields(CFRecord& record)
|
||||
{
|
||||
//record >> csxformat >> cchErrorString >> cchNullString >> cchTag >> csxselect;
|
||||
|
||||
//_UINT32 flags;
|
||||
//record >> crwPage >> ccolPage >> flags;
|
||||
|
||||
//fAcrossPageLay = GETBIT(flags, 0);
|
||||
//cWrapPage = GETBITS(flags, 1, 9);
|
||||
//fEnableWizard = GETBIT(flags, 16);
|
||||
//fEnableDrilldown = GETBIT(flags, 17);
|
||||
//fEnableFieldDialog = GETBIT(flags, 18);
|
||||
//fPreserveFormatting = GETBIT(flags, 19);
|
||||
//fMergeLabels = GETBIT(flags, 20);
|
||||
//fDisplayErrorString = GETBIT(flags, 21);
|
||||
//fDisplayNullString = GETBIT(flags, 22);
|
||||
//fSubtotalHiddenPageItems = GETBIT(flags, 23);
|
||||
|
||||
//record >> cchPageFieldStyle >> cchTableStyle >> cchVacateStyle;
|
||||
|
||||
//if (cchErrorString > 0 && cchErrorString != 0xffff)
|
||||
//{
|
||||
// stError.setSize(cchErrorString);
|
||||
// record >> stError;
|
||||
//}
|
||||
//if (cchNullString > 0 && cchNullString != 0xffff)
|
||||
//{
|
||||
// stDisplayNull.setSize(cchNullString);
|
||||
// record >> stDisplayNull;
|
||||
//}
|
||||
//if (cchTag > 0 && cchTag != 0xffff)
|
||||
//{
|
||||
// stTag.setSize(cchTag);
|
||||
// record >> stTag;
|
||||
//}
|
||||
//if (cchPageFieldStyle > 0 && cchPageFieldStyle != 0xffff)
|
||||
//{
|
||||
// stPageFieldStyle.setSize(cchPageFieldStyle);
|
||||
// record >> stPageFieldStyle;
|
||||
//}
|
||||
//if (cchTableStyle > 0 && cchTableStyle != 0xffff)
|
||||
//{
|
||||
// stTableStyle.setSize(cchTableStyle);
|
||||
// record >> cchTableStyle;
|
||||
//}
|
||||
//if (cchVacateStyle > 0 && cchVacateStyle != 0xffff)
|
||||
//{
|
||||
// stVacateStyle.setSize(cchVacateStyle);
|
||||
// record >> cchVacateStyle;
|
||||
//}
|
||||
|
||||
//int skip = record.getDataSize() - record.getRdPtr();
|
||||
//record.skipNunBytes(skip);
|
||||
fmla.load(record);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,8 +32,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/BiffString.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
|
||||
#include "../Biff_structures/PivotParsedFormula.h"
|
||||
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -52,36 +53,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSxFmla;
|
||||
|
||||
//unsigned short csxformat;
|
||||
//unsigned short cchErrorString;
|
||||
//unsigned short cchNullString;
|
||||
//unsigned short cchTag;
|
||||
//unsigned short csxselect;
|
||||
|
||||
//DRw crwPage;
|
||||
//ColU ccolPage;
|
||||
|
||||
//bool fAcrossPageLay;
|
||||
//unsigned char cWrapPage;
|
||||
//bool fEnableWizard;
|
||||
//bool fEnableDrilldown;
|
||||
//bool fEnableFieldDialog;
|
||||
//bool fPreserveFormatting;
|
||||
//bool fMergeLabels;
|
||||
//bool fDisplayErrorString;
|
||||
//bool fDisplayNullString;
|
||||
//bool fSubtotalHiddenPageItems;
|
||||
|
||||
//unsigned short cchPageFieldStyle;
|
||||
//unsigned short cchTableStyle;
|
||||
//unsigned short cchVacateStyle;
|
||||
|
||||
//XLUnicodeStringNoCch stError;
|
||||
//XLUnicodeStringNoCch stDisplayNull;
|
||||
//XLUnicodeStringNoCch stTag;
|
||||
//XLUnicodeStringNoCch stPageFieldStyle;
|
||||
//XLUnicodeStringNoCch stTableStyle;
|
||||
//XLUnicodeStringNoCch stVacateStyle;
|
||||
PivotParsedFormula fmla;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -51,6 +51,10 @@ BaseObjectPtr SxName::clone()
|
||||
|
||||
void SxName::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
record >> flags >> ifdb >> ifn >> csxpair;
|
||||
|
||||
fErrName = GETBIT(flags, 0);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,7 +50,10 @@ public:
|
||||
|
||||
static const ElementType type = typeSxName;
|
||||
|
||||
|
||||
bool fErrName;
|
||||
short ifdb;
|
||||
short ifn;
|
||||
unsigned short csxpair;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
//#include "../Biff_structures/CellRangeRef.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -50,8 +49,6 @@ public:
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeSxNil;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -170,7 +170,7 @@ int TxO::serialize (std::wostream & _stream)
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < TxOruns.rgTxoRuns.size(); i++)
|
||||
for (size_t i = 0 ; i < TxOruns.rgTxoRuns.size(); i++)
|
||||
{
|
||||
Run *run = dynamic_cast<Run*>(TxOruns.rgTxoRuns[i].get());
|
||||
if (run == NULL) continue;
|
||||
|
||||
@ -45,8 +45,6 @@ public:
|
||||
|
||||
BiffStructurePtr clone();
|
||||
void load(CFRecord& record);
|
||||
|
||||
|
||||
|
||||
std::vector<CellRangeRef> cell_ranges;
|
||||
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* (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 "PivotParsedFormula.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
PivotParsedFormula::PivotParsedFormula()
|
||||
: ParsedFormula(CellRef())
|
||||
{
|
||||
}
|
||||
|
||||
BiffStructurePtr PivotParsedFormula::clone()
|
||||
{
|
||||
return BiffStructurePtr(new PivotParsedFormula(*this));
|
||||
}
|
||||
|
||||
void PivotParsedFormula::load(CFRecord& record)
|
||||
{
|
||||
unsigned short cce;
|
||||
|
||||
record >> cce >> cSxName;
|
||||
rgce.load(record, cce);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* (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 "ParsedFormula.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class PivotParsedFormula: public ParsedFormula
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(PivotParsedFormula)
|
||||
public:
|
||||
PivotParsedFormula();
|
||||
|
||||
BiffStructurePtr clone();
|
||||
void load(CFRecord& record);
|
||||
|
||||
unsigned short cSxName;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -294,7 +294,7 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
|
||||
|
||||
int iCrt = -1;
|
||||
|
||||
for (int i = 0 ; i < charts->m_arSERIESFORMAT.size(); i++)
|
||||
for (size_t i = 0 ; i < charts->m_arSERIESFORMAT.size(); i++)
|
||||
{
|
||||
SERIESFORMAT * series = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[i].get());
|
||||
if (series == NULL) continue;
|
||||
@ -641,8 +641,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
{
|
||||
CP_XML_NODE(L"c:plotArea")
|
||||
{
|
||||
|
||||
for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
for (size_t i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
{
|
||||
AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get());
|
||||
ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get());
|
||||
@ -751,7 +750,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
|
||||
series->serialize_legend(stream_legend_entries, it->second[i]);
|
||||
}
|
||||
for (int i = 0 ; i < crt->m_arCrtLine.size(); i++)
|
||||
for (size_t i = 0 ; i < crt->m_arCrtLine.size(); i++)
|
||||
{
|
||||
CrtLine* crtLine = dynamic_cast<CrtLine*>(crt->m_arCrtLine[i].get());
|
||||
if (crtLine == NULL) continue;
|
||||
@ -1068,7 +1067,7 @@ int ChartSheetSubstream::serialize_ser (std::wstring sNodeSer, std::wostream & _
|
||||
SIIndex * series_cash = NULL;
|
||||
|
||||
int type_val = 0;
|
||||
for (int i = 0; (series_data) && (i < series_data->m_arSIIndex.size()); i++)
|
||||
for (size_t i = 0; (series_data) && (i < series_data->m_arSIIndex.size()); i++)
|
||||
{
|
||||
SIIndex * si_in = dynamic_cast<SIIndex *>(series_data->m_arSIIndex[i].get());
|
||||
|
||||
|
||||
@ -621,12 +621,12 @@ namespace NSCustomShapesConvert
|
||||
ConvertSum(oHandle.PolarCentre.y, oHandle.PolarCentreType.y, m_lIndexDst-2, ptFormula, 0, ptValue, false, true, false, m_oGuidsRes);
|
||||
m_arIndexDst.push_back(m_lIndexDst-1);
|
||||
|
||||
std::wstring strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
|
||||
std::wstring strMem = std::to_wstring(m_lIndexDst - 2);
|
||||
|
||||
oHandle.Pos.x = GetHandlePos(strMem, _T("w"), m_lWidth);
|
||||
oHandle.PosType.x = ptFormula;
|
||||
|
||||
strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
|
||||
strMem = std::to_wstring(m_lIndexDst - 2);
|
||||
oHandle.Pos.y = GetHandlePos(strMem, _T("h"), m_lHeight);
|
||||
oHandle.PosType.y = ptFormula;
|
||||
}
|
||||
@ -800,20 +800,20 @@ namespace NSCustomShapesConvert
|
||||
case ptFormula:
|
||||
{
|
||||
if (bExtShape)
|
||||
strValue = boost::lexical_cast<std::wstring>(lParam);
|
||||
strValue = std::to_wstring(lParam);
|
||||
else
|
||||
strValue = boost::lexical_cast<std::wstring>(m_arIndexDst[lParam]);
|
||||
strValue = std::to_wstring(m_arIndexDst[lParam]);
|
||||
strValue = _T("gd") + strValue;
|
||||
break;
|
||||
}
|
||||
case ptAdjust:
|
||||
{
|
||||
strValue = _T("adj") + boost::lexical_cast<std::wstring>(lParam);
|
||||
strValue = _T("adj") + std::to_wstring(lParam);
|
||||
break;
|
||||
}
|
||||
case ptValue:
|
||||
{
|
||||
strValue = boost::lexical_cast<std::wstring>(lParam);
|
||||
strValue = std::to_wstring(lParam);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1080,7 +1080,7 @@ namespace NSCustomShapesConvert
|
||||
std::wstring strSize;
|
||||
std::wstring strIndex;
|
||||
|
||||
strSize = boost::lexical_cast<std::wstring>( lSize);
|
||||
strSize = std::to_wstring( lSize);
|
||||
|
||||
if ('#' == strParam[0])
|
||||
{
|
||||
@ -1114,7 +1114,7 @@ namespace NSCustomShapesConvert
|
||||
|
||||
m_lIndexSrc++;
|
||||
m_arIndexDst.push_back(m_lIndexDst);
|
||||
strIndex = boost::lexical_cast<std::wstring>(m_lIndexDst);
|
||||
strIndex = std::to_wstring(m_lIndexDst);
|
||||
|
||||
m_oGuidsRes.WriteString(_T("<a:gd name=\"gd"));
|
||||
m_oGuidsRes.WriteString(strIndex);
|
||||
|
||||
@ -59,6 +59,7 @@
|
||||
#include "../XlsFormat/Logic/Biff_unions/BACKGROUND.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTVIEW.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHE.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h"
|
||||
|
||||
#include <Logic/Biff_records/BkHim.h>
|
||||
#include <Logic/Biff_records/HLink.h>
|
||||
@ -346,7 +347,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
count_sheets++;
|
||||
xls_global_info->current_sheet = count_sheets;
|
||||
|
||||
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + boost::lexical_cast<std::wstring>(count_sheets));
|
||||
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + std::to_wstring(count_sheets));
|
||||
xlsx_context->set_state(xls_global_info->sheets_state.size() > i ? xls_global_info->sheets_state[i] : L"visible");
|
||||
|
||||
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
|
||||
@ -355,7 +356,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
{
|
||||
count_chart_sheets++;
|
||||
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_" + boost::lexical_cast<std::wstring>(count_chart_sheets));
|
||||
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()));
|
||||
}
|
||||
@ -638,7 +639,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
|
||||
xlsx_context->get_mediaitems().create_media_path(xlsx_path);
|
||||
|
||||
bool res = false;
|
||||
std::wstring file_name = L"image" + boost::lexical_cast<std::wstring>(id);
|
||||
std::wstring file_name = L"image" + std::to_wstring(id);
|
||||
|
||||
|
||||
if (type_ext == L"dib_data")
|
||||
@ -1921,4 +1922,16 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
|
||||
{
|
||||
if (pivot_cached == NULL) return;
|
||||
|
||||
xlsx_context->start_pivot_cache();
|
||||
|
||||
pivot_cached->serialize(xlsx_context->current_pivot_cache().definitions());
|
||||
|
||||
//if (pivot_cached->is_records())//??
|
||||
{
|
||||
xlsx_context->current_pivot_cache().isRecordsPresent = true;
|
||||
|
||||
//pivot_cached->serialize_records(xlsx_context->current_pivot_cache().records());
|
||||
}
|
||||
|
||||
xlsx_context->end_pivot_cache();
|
||||
}
|
||||
@ -86,7 +86,7 @@ std::wstring static get_default_file_name(external_items::Type type)
|
||||
// }
|
||||
// //todooo проверить
|
||||
//
|
||||
// return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
|
||||
// return get_default_file_name(type) + std::to_wstring(Num) + sExt;
|
||||
//}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ std::wstring external_items::add_image(const std::wstring & image, int bin_id)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image+1);
|
||||
std::wstring rId = std::wstring(L"picId") + std::to_wstring(count_image+1);
|
||||
count_image++;
|
||||
|
||||
items_.push_back( item(image, typeImage, isMediaInternal, bin_id, rId) );
|
||||
@ -108,8 +108,8 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
|
||||
|
||||
count_charts++;
|
||||
|
||||
std::wstring rId = std::wstring(L"chartId") + boost::lexical_cast<std::wstring>(count_charts);
|
||||
oox_target = std::wstring(L"charts/chart") + boost::lexical_cast<std::wstring>(count_charts) + L".xml";
|
||||
std::wstring rId = std::wstring(L"chartId") + std::to_wstring(count_charts);
|
||||
oox_target = std::wstring(L"charts/chart") + std::to_wstring(count_charts) + L".xml";
|
||||
|
||||
items_.push_back( item(oox_target, typeChart, isMediaInternal, -1, rId) );
|
||||
|
||||
|
||||
@ -172,24 +172,16 @@ void rels_files::add(std::wstring const & Id,
|
||||
{
|
||||
return add(relationship(Id, Type, Target, TargetMode));
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
chart_content::chart_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(chart_content) chart_content::create()
|
||||
{
|
||||
return boost::make_shared<chart_content>();
|
||||
}
|
||||
|
||||
//void chart_content::add_rel(relationship const & r)
|
||||
//{
|
||||
// rels_->get_rels().add(r);
|
||||
//}
|
||||
|
||||
///////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------
|
||||
element_ptr simple_element::create(const std::wstring & FileName, const std::wstring & Content)
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
|
||||
@ -111,7 +111,7 @@ private:
|
||||
class rels_file;
|
||||
typedef boost::shared_ptr<rels_file> rels_file_ptr;
|
||||
|
||||
/// \class rels_file
|
||||
//------------------------------------------------------------------------
|
||||
class rels_file : public element
|
||||
{
|
||||
public:
|
||||
@ -132,7 +132,7 @@ private:
|
||||
rels rels_;
|
||||
};
|
||||
|
||||
/// \class rels_files
|
||||
//------------------------------------------------------------------------
|
||||
class rels_files : public element
|
||||
{
|
||||
public:
|
||||
@ -150,9 +150,7 @@ private:
|
||||
rels_file_ptr rels_file_;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
///\class chart_files
|
||||
//------------------------------------------------------------------------
|
||||
class chart_content;
|
||||
typedef _CP_PTR(chart_content) chart_content_ptr;
|
||||
|
||||
@ -173,8 +171,7 @@ private:
|
||||
rels_file_ptr rels_file_;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
class document : public element
|
||||
{
|
||||
public:
|
||||
|
||||
@ -33,8 +33,6 @@
|
||||
#include "oox_rels.h"
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
//#include <boost/lexical_cast.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <simple_xml_writer.h>
|
||||
@ -66,8 +64,9 @@ public:
|
||||
|
||||
void dump_rels(rels & Rels)
|
||||
{
|
||||
BOOST_FOREACH(rel_ const & r, chartRels_)
|
||||
for (size_t i = 0; i < chartRels_.size(); i++)
|
||||
{
|
||||
rel_ & r = chartRels_[i];
|
||||
if (r.type_ == external_items::typeImage)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
@ -99,8 +98,9 @@ public:
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
BOOST_FOREACH(rel_ const & r, chartRels_)
|
||||
{
|
||||
for (size_t i = 0; i < chartRels_.size(); i++)
|
||||
{
|
||||
rel_ & r = chartRels_[i];
|
||||
if (r.rid_ == rid && r.target_ == target)
|
||||
present = true;
|
||||
}
|
||||
|
||||
@ -114,14 +114,14 @@ public:
|
||||
if (c.author_ == author_list_[i])
|
||||
{
|
||||
find = true;
|
||||
c.author_ = boost::lexical_cast<std::wstring>(i);
|
||||
c.author_ = std::to_wstring(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find)
|
||||
{
|
||||
author_list_.push_back(c.author_);
|
||||
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
|
||||
c.author_ = std::to_wstring(author_list_.size()-1);
|
||||
}
|
||||
xlsx_comment_.push_back(c);
|
||||
}
|
||||
|
||||
@ -52,13 +52,13 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
|
||||
{
|
||||
const std::wstring file_comments_id = boost::lexical_cast<std::wstring>(next_comments_file_id_++);
|
||||
const std::wstring file_comments_id = std::to_wstring(next_comments_file_id_++);
|
||||
|
||||
const std::wstring fileName = std::wstring(L"comments") + file_comments_id + L".xml";
|
||||
|
||||
comments_.push_back(comment_elm(fileName, content, comments));
|
||||
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
|
||||
const std::wstring id = std::to_wstring(next_comments_id_++);
|
||||
const std::wstring rId = std::wstring(L"comId") + id;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
@ -84,6 +84,17 @@ xlsx_xml_worksheet & xlsx_conversion_context::current_sheet()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
xlsx_pivot_cache_context & xlsx_conversion_context::current_pivot_cache()
|
||||
{
|
||||
if (!pivot_caches_.empty())
|
||||
{
|
||||
return *pivot_caches_.back().get();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
oox_chart_context & xlsx_conversion_context::current_chart()
|
||||
{
|
||||
if (!charts_.empty())
|
||||
@ -118,11 +129,17 @@ void xlsx_conversion_context::start_chart()
|
||||
//этот контекст нужно передавать в файл
|
||||
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::end_chart()
|
||||
{
|
||||
//current_chart().set_drawing_link(current_sheet().get_drawing_link());
|
||||
//излишняя инфа
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_pivot_cache()
|
||||
{
|
||||
pivot_caches_.push_back(xlsx_pivot_cache_context::create());
|
||||
|
||||
}
|
||||
void xlsx_conversion_context::end_pivot_cache()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::end_table()
|
||||
@ -144,10 +161,11 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
unsigned int count = 0;
|
||||
// добавляем таблицы
|
||||
BOOST_FOREACH(const xlsx_xml_worksheet_ptr& sheet, sheets_)
|
||||
{
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
xlsx_xml_worksheet_ptr & sheet = sheets_[i];
|
||||
count++;
|
||||
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(count);
|
||||
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(count);
|
||||
|
||||
package::sheet_content_ptr content = package::sheet_content::create();
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -201,68 +219,89 @@ void xlsx_conversion_context::end_document()
|
||||
CP_XML_ATTR(L"name", sheet->name());
|
||||
CP_XML_ATTR(L"sheetId", count);
|
||||
CP_XML_ATTR(L"state", sheet->state() );
|
||||
CP_XML_ATTR(L"r:id", id);
|
||||
CP_XML_ATTR(L"r:id", slideRId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//добавляем диаграммы
|
||||
|
||||
count = 0;
|
||||
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
|
||||
chart->dump_rels(content->get_rels());
|
||||
chart->write_to(content->content());
|
||||
charts_[i]->dump_rels(content->get_rels());
|
||||
charts_[i]->write_to(content->content());
|
||||
|
||||
output_document_->get_xl_files().add_charts(content);
|
||||
|
||||
}
|
||||
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
|
||||
|
||||
{
|
||||
output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", xlsx_shared_strings_.str()) );
|
||||
}
|
||||
output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", xlsx_shared_strings_.str()) );
|
||||
|
||||
|
||||
std::wstringstream strm_workbook;
|
||||
|
||||
CP_XML_WRITER(strm_workbook)
|
||||
{
|
||||
std::wstringstream strm_workbook;
|
||||
|
||||
CP_XML_WRITER(strm_workbook)
|
||||
CP_XML_NODE(L"workbook")
|
||||
{
|
||||
CP_XML_NODE(L"workbook")
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
CP_XML_NODE(L"bookViews")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_STREAM() << xlsx_workbook_views_.str();
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"bookViews")
|
||||
{
|
||||
CP_XML_STREAM() << xlsx_workbook_views_.str();
|
||||
}
|
||||
CP_XML_NODE(L"sheets")
|
||||
{
|
||||
CP_XML_STREAM() << workbook_content.str();
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"sheets")
|
||||
{
|
||||
CP_XML_STREAM() << workbook_content.str();
|
||||
}
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
CP_XML_STREAM() << xlsx_defined_names_.str();
|
||||
}
|
||||
|
||||
std::wstring str_ = xlsx_custom_views_.str();
|
||||
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
CP_XML_STREAM() << xlsx_defined_names_.str();
|
||||
}
|
||||
|
||||
std::wstring str_ = xlsx_custom_views_.str();
|
||||
|
||||
if (!str_.empty())
|
||||
if (!str_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"customWorkbookViews")
|
||||
{
|
||||
CP_XML_NODE(L"customWorkbookViews")
|
||||
CP_XML_STREAM() << str_;
|
||||
}
|
||||
}
|
||||
if (!pivot_caches_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"pivotCaches")
|
||||
{
|
||||
for (size_t i = 0; i < pivot_caches_.size(); i++)
|
||||
{
|
||||
CP_XML_STREAM() << str_;
|
||||
std::wstring rId = L"pcId" + std::to_wstring(i+1);
|
||||
static const std::wstring sType = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
|
||||
const std::wstring sName = std::wstring(L"../pivotCache/pivotCacheDefinition" + std::to_wstring(i + 1) + L".xml");
|
||||
|
||||
package::pivot_cache_content_ptr content = package::pivot_cache_content::create();
|
||||
|
||||
CP_XML_NODE(L"pivotCache")
|
||||
{
|
||||
CP_XML_ATTR(L"cacheId", std::to_wstring(i));
|
||||
CP_XML_ATTR(L"r:id", rId);
|
||||
}
|
||||
|
||||
pivot_caches_[i]->dump_rels(content->get_rels());
|
||||
pivot_caches_[i]->write_to(content->definitions());
|
||||
|
||||
if (pivot_caches_[i]->isRecordsPresent)
|
||||
{
|
||||
pivot_caches_[i]->write_records_to(content->records());
|
||||
|
||||
}
|
||||
output_document_->get_xl_files().add_pivot_cache(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
#include "xlsx_drawing_context.h"
|
||||
#include "xlsx_chart_context.h"
|
||||
#include "xlsx_comments_context.h"
|
||||
#include "xlsx_pivot_cache_context.h"
|
||||
|
||||
#include "xlsx_output_xml.h"
|
||||
|
||||
@ -70,6 +71,9 @@ public:
|
||||
void start_chart();
|
||||
void end_chart();
|
||||
|
||||
void start_pivot_cache();
|
||||
void end_pivot_cache();
|
||||
|
||||
std::wostream & shared_strings() { return xlsx_shared_strings_; }
|
||||
std::wostream & defined_names() { return xlsx_defined_names_; }
|
||||
std::wostream & workbook_views() { return xlsx_workbook_views_; }
|
||||
@ -80,6 +84,7 @@ public:
|
||||
xlsx_xml_worksheet & current_sheet();
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
xlsx_pivot_cache_context & current_pivot_cache();
|
||||
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
@ -95,9 +100,10 @@ private:
|
||||
|
||||
external_items mediaitems_;
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
std::vector<xlsx_pivot_cache_context_ptr> pivot_caches_;
|
||||
|
||||
//std::wstringstream defaultOutput_;
|
||||
//std::pair<float,float> maxDigitSize_;
|
||||
//num_format_context num_format_context_;
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
|
||||
{//todooo отсчеты номеров файлов отдельно
|
||||
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
|
||||
drawings_.push_back(drawing_elm(fileName, content, rels));
|
||||
@ -97,8 +97,8 @@ public:
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
|
||||
{
|
||||
const std::wstring drawing_id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
|
||||
const std::wstring file_vml_id = boost::lexical_cast<std::wstring>(next_vml_file_id_++);
|
||||
const std::wstring drawing_id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring file_vml_id = std::to_wstring(next_vml_file_id_++);
|
||||
const std::wstring fileName = std::wstring(L"vmlDrawing") + file_vml_id + L".vml";
|
||||
|
||||
drawings_vml_.push_back(drawing_elm(fileName, content, rels));
|
||||
@ -587,7 +587,7 @@ void xlsx_drawing_context::serialize_group()
|
||||
|
||||
if (drawing_state->name.empty())
|
||||
{
|
||||
drawing_state->name = L"Group_" + boost::lexical_cast<std::wstring>(count_object);
|
||||
drawing_state->name = L"Group_" + std::to_wstring(count_object);
|
||||
}
|
||||
CP_XML_ATTR(L"name", drawing_state->name);
|
||||
|
||||
@ -641,24 +641,24 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
|
||||
std::wstringstream strmStyle;
|
||||
|
||||
strmStyle << L"position:absolute;";
|
||||
strmStyle << L"margin-left:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
|
||||
strmStyle << L"margin-top:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.y / 12700.) << L"pt;";
|
||||
strmStyle << L"width:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx / 12700.) << L"pt;";
|
||||
strmStyle << L"height:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy / 12700.) << L"pt;";
|
||||
strmStyle << L"z-index:" << boost::lexical_cast<std::wstring>(drawing_state->id) << L";";
|
||||
strmStyle << L"margin-left:" << std::to_wstring(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
|
||||
strmStyle << L"margin-top:" << std::to_wstring(drawing_state->child_anchor.y / 12700.) << L"pt;";
|
||||
strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
|
||||
strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
|
||||
strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
|
||||
|
||||
if (drawing_state->object.visible == false)
|
||||
strmStyle << L"visibility:hidden;";
|
||||
|
||||
CP_XML_NODE(L"v:shape")
|
||||
{
|
||||
//CP_XML_ATTR(L"id" , boost::lexical_cast<std::wstring>(drawing_state->object.id));
|
||||
//CP_XML_ATTR(L"id" , std::to_wstring(drawing_state->object.id));
|
||||
CP_XML_ATTR(L"type" , L"_x0000_t202");
|
||||
CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB);
|
||||
|
||||
if (drawing_state->line.width > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"strokeweight", boost::lexical_cast<std::wstring>(drawing_state->line.width) +L"pt");
|
||||
CP_XML_ATTR(L"strokeweight", std::to_wstring(drawing_state->line.width) +L"pt");
|
||||
}
|
||||
CP_XML_ATTR(L"style", strmStyle.str());
|
||||
|
||||
@ -770,9 +770,9 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state,
|
||||
std::wstring style = std::wstring(L"position:absolute;margin-left:0;margin-top:0;");
|
||||
|
||||
//todooo сделать "покороче" значения .. достаточно 2 знаков после запятой
|
||||
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"z-index:") + boost::lexical_cast<std::wstring>(drawing_state->id) + std::wstring(L";");
|
||||
style += std::wstring(L"width:") + std::to_wstring(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"height:") + std::to_wstring(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
|
||||
style += std::wstring(L"z-index:") + std::to_wstring(drawing_state->id) + std::wstring(L";");
|
||||
|
||||
CP_XML_ATTR(L"style",style);
|
||||
|
||||
@ -865,7 +865,7 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
|
||||
CP_XML_ATTR(L"id", drawing_state->id);
|
||||
|
||||
if (drawing_state->name.empty())
|
||||
drawing_state->name = L"Chart_" + boost::lexical_cast<std::wstring>(count_object);
|
||||
drawing_state->name = L"Chart_" + std::to_wstring(count_object);
|
||||
|
||||
CP_XML_ATTR(L"name", drawing_state->name);
|
||||
if (!drawing_state->description.empty())
|
||||
@ -941,9 +941,9 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
|
||||
if (drawing_state->name.empty())
|
||||
{
|
||||
if (drawing_state->wordart.is)
|
||||
drawing_state->name = L"WordArt_" + boost::lexical_cast<std::wstring>(count_object);
|
||||
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
|
||||
else
|
||||
drawing_state->name = L"Shape_" + boost::lexical_cast<std::wstring>(count_object);
|
||||
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
|
||||
}
|
||||
CP_XML_ATTR(L"name", drawing_state->name);
|
||||
|
||||
@ -2232,7 +2232,7 @@ void xlsx_drawing_context::set_hyperlink(const std::wstring & link, const std::w
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
std::wstring sId = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_.size()+1);
|
||||
std::wstring sId = std::wstring(L"hId") + std::to_wstring(hlinks_.size()+1);
|
||||
std::wstring link_correct = link;
|
||||
|
||||
if (!is_external) link_correct = std::wstring(L"#") + link_correct;
|
||||
|
||||
@ -80,7 +80,7 @@ public:
|
||||
record r;
|
||||
r.ref = ref;
|
||||
r.display = display;
|
||||
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1);
|
||||
r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
|
||||
r.location = target;
|
||||
|
||||
if (bExternal) r.type = L"External" ;
|
||||
|
||||
@ -32,8 +32,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include "common.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
@ -44,7 +42,6 @@ namespace oox {
|
||||
class xlsx_xml_worksheet;
|
||||
typedef boost::shared_ptr<xlsx_xml_worksheet> xlsx_xml_worksheet_ptr;
|
||||
|
||||
/// \class xlsx_xml_worksheet
|
||||
class xlsx_xml_worksheet: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
@ -80,12 +80,21 @@ void xlsx_document::write(const std::wstring & RootPath)
|
||||
rels_files_.write(RootPath);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
//--------------------------------------------------------------------------------------------
|
||||
pivot_cache_content::pivot_cache_content() : definitions_rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(pivot_cache_content) pivot_cache_content::create()
|
||||
{
|
||||
return boost::make_shared<pivot_cache_content>();
|
||||
}
|
||||
|
||||
sheet_content::sheet_content() : rels_(rels_file::create(L""))
|
||||
{
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
|
||||
_CP_PTR(sheet_content) sheet_content::create()
|
||||
{
|
||||
@ -119,33 +128,32 @@ void sheets_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"worksheets";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (int i = 0; i < sheets_.size(); i++)
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
if (sheets_[i])
|
||||
if (!sheets_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
|
||||
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
|
||||
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
|
||||
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
|
||||
rels_files relFiles;
|
||||
relFiles.add_rel_file(sheets_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
|
||||
//item->get_rel_file()->write(path.string<std::wstring>());
|
||||
|
||||
package::simple_element(fileName, sheets_[i]->str()).write(path);
|
||||
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
|
||||
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
|
||||
rels_files relFiles;
|
||||
relFiles.add_rel_file(sheets_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
|
||||
//item->get_rel_file()->write(path.string<std::wstring>());
|
||||
|
||||
package::simple_element(fileName, sheets_[i]->str()).write(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,6 +210,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
{
|
||||
pivot_cache_files_.set_rels(&rels_files_);
|
||||
pivot_cache_files_.set_main_document(get_main_document());
|
||||
pivot_cache_files_.write(path);
|
||||
}
|
||||
if (drawings_)
|
||||
{
|
||||
@ -264,7 +277,63 @@ void xl_files::add_charts(chart_content_ptr chart)
|
||||
{
|
||||
charts_files_.add_chart(chart);
|
||||
}
|
||||
////////////////////////////
|
||||
void xl_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
pivot_cache_files_.add_pivot_cache(pivot_cache);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
pivot_caches_.push_back(pivot_cache);
|
||||
}
|
||||
void xl_pivot_cache_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"pivotCache";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
|
||||
static const std::wstring kWSConTypeD = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
|
||||
static const std::wstring kWSConTypeR = L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
|
||||
|
||||
for (size_t i = 0; i < pivot_caches_.size(); i++)
|
||||
{
|
||||
if (pivot_caches_[i])
|
||||
{
|
||||
const std::wstring fileNameD = std::wstring(L"pivotCacheDefinition") + std::to_wstring(i + 1) + L".xml";
|
||||
|
||||
contentTypes.add_override(std::wstring(L"/xl/pivotCache/") + fileNameD, kWSConTypeD);
|
||||
|
||||
package::simple_element(fileNameD, pivot_caches_[i]->str_d()).write(path);
|
||||
|
||||
if (pivot_caches_[i]->get_rels().empty() == false)
|
||||
{
|
||||
rels_files relFiles;
|
||||
pivot_caches_[i]->definitions_rels_file_->set_file_name(fileNameD + L".rels");
|
||||
|
||||
relFiles.add_rel_file(pivot_caches_[i]->definitions_rels_file_);
|
||||
relFiles.write(path);
|
||||
}
|
||||
if (rels_) //for workbook
|
||||
{
|
||||
const std::wstring id = std::wstring(L"pcId") + std::to_wstring(i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
|
||||
const std::wstring fileRef = std::wstring(L"pivotCache/") + fileNameD;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
std::wstring content_records = pivot_caches_[i]->str_r();
|
||||
if (!content_records.empty())
|
||||
{
|
||||
const std::wstring fileNameR = std::wstring(L"pivotCacheRecords") + std::to_wstring(i + 1) + L".xml";
|
||||
|
||||
contentTypes.add_override(std::wstring(L"/xl/pivotCache/") + fileNameR, kWSConTypeD);
|
||||
|
||||
package::simple_element(fileNameR, content_records).write(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_charts_files::add_chart(chart_content_ptr chart)
|
||||
{
|
||||
charts_.push_back(chart);
|
||||
@ -274,14 +343,15 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
if (charts_[i])
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
contentTypes.add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, charts_[i]->str()).write(path);
|
||||
@ -297,7 +367,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
//////////////////////////
|
||||
//----------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
{
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms));
|
||||
@ -308,7 +378,7 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (int i = 0; i < drawings_.size(); i++)
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
|
||||
|
||||
@ -343,7 +413,7 @@ void xl_comments::write(const std::wstring & RootPath)
|
||||
std::wstring vml_path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(vml_path.c_str());
|
||||
|
||||
for (int i = 0; i < comments_.size(); i++)
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
#include "xlsx_drawings.h"
|
||||
#include "xlsx_comments.h"
|
||||
|
||||
|
||||
namespace oox {
|
||||
namespace package {
|
||||
|
||||
@ -47,7 +46,7 @@ class xlsx_content_types_file : public content_types_file
|
||||
public:
|
||||
xlsx_content_types_file();
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
class sheet_content;
|
||||
typedef _CP_PTR(sheet_content) sheet_content_ptr;
|
||||
|
||||
@ -66,7 +65,30 @@ private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class pivot_cache_content;
|
||||
typedef _CP_PTR(pivot_cache_content) pivot_cache_content_ptr;
|
||||
|
||||
class pivot_cache_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
pivot_cache_content();
|
||||
static _CP_PTR(pivot_cache_content) create();
|
||||
|
||||
std::wostream & definitions() { return definitions_; }
|
||||
std::wostream & records() { return records_; }
|
||||
rels & get_rels() { return definitions_rels_file_->get_rels(); }
|
||||
|
||||
std::wstring str_d() { return definitions_.str(); }
|
||||
std::wstring str_r() { return records_.str(); }
|
||||
|
||||
friend class xl_pivot_cache_files;
|
||||
private:
|
||||
std::wstringstream records_;
|
||||
std::wstringstream definitions_;
|
||||
rels_file_ptr definitions_rels_file_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class sheets_files : public element
|
||||
{
|
||||
public:
|
||||
@ -81,7 +103,6 @@ public:
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
public:
|
||||
std::vector<sheet_content_ptr> sheets_;
|
||||
rels_files * rels_;
|
||||
|
||||
@ -98,6 +119,24 @@ public:
|
||||
std::vector<chart_content_ptr> charts_;
|
||||
|
||||
};
|
||||
|
||||
class xl_pivot_cache_files : public element
|
||||
{
|
||||
public:
|
||||
xl_pivot_cache_files(){}
|
||||
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
|
||||
void add_pivot_cache(pivot_cache_content_ptr pivot_cache);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<pivot_cache_content_ptr> pivot_caches_;
|
||||
|
||||
rels_files * rels_;
|
||||
};
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class xl_comments;
|
||||
@ -161,13 +200,16 @@ public:
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
void add_charts (chart_content_ptr chart);
|
||||
void add_pivot_cache (pivot_cache_content_ptr pivot);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
sheets_files sheets_files_;
|
||||
xl_charts_files charts_files_;
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
rels_files rels_files_;
|
||||
sheets_files sheets_files_;
|
||||
xl_charts_files charts_files_;
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
element_ptr styles_;
|
||||
element_ptr sharedStrings_;
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "xlsx_pivot_cache_context.h"
|
||||
|
||||
#include "oox_rels.h"
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <simple_xml_writer.h>
|
||||
|
||||
namespace oox {
|
||||
|
||||
class xlsx_pivot_cache_context::Impl
|
||||
{
|
||||
// struct rel_
|
||||
// {
|
||||
// rel_(bool is_internal, std::wstring const & rid, std::wstring const & target, external_items::Type type) :
|
||||
// is_internal_(is_internal),
|
||||
// rid_(rid),
|
||||
//target_(target),
|
||||
// type_(type)
|
||||
// {}
|
||||
|
||||
// bool is_internal_;
|
||||
// std::wstring rid_;
|
||||
// std::wstring target_;
|
||||
// external_items::Type type_;
|
||||
// };
|
||||
|
||||
public:
|
||||
Impl() {}
|
||||
|
||||
std::wstringstream definitionsData_;
|
||||
std::wstringstream recordsData_;
|
||||
|
||||
//rels rels_;
|
||||
|
||||
};
|
||||
|
||||
xlsx_pivot_cache_context_ptr xlsx_pivot_cache_context::create()
|
||||
{
|
||||
return boost::make_shared<xlsx_pivot_cache_context>();
|
||||
}
|
||||
|
||||
int countPivotCaches = 0;
|
||||
|
||||
xlsx_pivot_cache_context::xlsx_pivot_cache_context() : impl_(new xlsx_pivot_cache_context::Impl()), isRecordsPresent(false)
|
||||
{
|
||||
index = ++countPivotCaches;
|
||||
}
|
||||
std::wostream & xlsx_pivot_cache_context::definitions()
|
||||
{
|
||||
return impl_->definitionsData_;
|
||||
}
|
||||
std::wostream & xlsx_pivot_cache_context::records()
|
||||
{
|
||||
return impl_->recordsData_;
|
||||
}
|
||||
//void xlsx_pivot_cache_context::add_rels(
|
||||
// bool isInternal,
|
||||
// std::wstring const & rid,
|
||||
// std::wstring const & target,
|
||||
// external_items::Type type)
|
||||
//{
|
||||
// impl_->add_rels(isInternal, rid, target, type);
|
||||
//}
|
||||
void xlsx_pivot_cache_context::dump_rels(rels & Rels)
|
||||
{
|
||||
if (isRecordsPresent)
|
||||
{
|
||||
Rels.add(relationship(L"rId1",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCacheRecords" + std::to_wstring(index) + L".xml", L""));
|
||||
}
|
||||
}
|
||||
void xlsx_pivot_cache_context::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
if (isRecordsPresent)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", L"rId1" );
|
||||
}
|
||||
CP_XML_ATTR(L"recordCount", 0);
|
||||
//refreshedBy="Debra S Dalgleish"
|
||||
//refreshedDate="39449.496381365738"
|
||||
//createdVersion="1"
|
||||
//refreshedVersion="2"
|
||||
//recordCount="11"
|
||||
//upgradeOnRefresh="1">
|
||||
|
||||
CP_XML_STREAM() << impl_->definitionsData_.str();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void xlsx_pivot_cache_context::write_records_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheRecords")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
CP_XML_ATTR(L"count", 0);
|
||||
|
||||
CP_XML_STREAM() << impl_->recordsData_.str();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xlsx_pivot_cache_context::~xlsx_pivot_cache_context()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "oox_package.h"
|
||||
|
||||
namespace oox {
|
||||
|
||||
class xlsx_pivot_cache_context;
|
||||
typedef _CP_PTR(xlsx_pivot_cache_context) xlsx_pivot_cache_context_ptr;
|
||||
|
||||
class xlsx_pivot_cache_context
|
||||
{
|
||||
public:
|
||||
xlsx_pivot_cache_context();
|
||||
~xlsx_pivot_cache_context();
|
||||
|
||||
std::wostream & definitions();
|
||||
std::wostream & records();
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
void write_records_to(std::wostream & strm);
|
||||
|
||||
void dump_rels(rels & Rels);
|
||||
|
||||
static xlsx_pivot_cache_context_ptr create();
|
||||
//void add_rels( bool isInternal,
|
||||
// std::wstring const & rid,
|
||||
// std::wstring const & target,
|
||||
// external_items::Type type);
|
||||
|
||||
bool isRecordsPresent;
|
||||
int index;
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@ -613,6 +613,7 @@ SOURCES += \
|
||||
../XlsFormat/Logic/Biff_structures/DConnStringSequence.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/TxtWf.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/Xnum.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/PivotParsedFormula.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/ODRAW/MSOCR.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/ODRAW/MSOSHADECOLOR.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.cpp \
|
||||
@ -839,6 +840,7 @@ SOURCES += \
|
||||
../XlsXlsxConverter/xlsx_tablecontext.cpp \
|
||||
../XlsXlsxConverter/xlsx_textcontext.cpp \
|
||||
../XlsXlsxConverter/xlsx_chart_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_pivot_cache_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_comments.cpp \
|
||||
../XlsXlsxConverter/xlsx_comments_context.cpp \
|
||||
|
||||
@ -1596,6 +1598,7 @@ HEADERS += \
|
||||
../XlsXlsxConverter/xlsx_conversion_context.h \
|
||||
../XlsXlsxConverter/xlsx_drawing_context.h \
|
||||
../XlsXlsxConverter/xlsx_drawings.h \
|
||||
../XlsXlsxConverter/xlsx_pivot_cache_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_hyperlinks.h \
|
||||
../XlsXlsxConverter/xlsx_output_xml.h \
|
||||
../XlsXlsxConverter/xlsx_package.h \
|
||||
|
||||
@ -618,6 +618,7 @@
|
||||
#include "../XlsFormat/Logic/Biff_structures/SharedProperty.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_structures/AFDOperBoolErr.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_structures/AFDOperXNum.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_structures/PivotParsedFormula.cpp"
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_unions/AI.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp"
|
||||
|
||||
@ -4237,6 +4237,14 @@
|
||||
RelativePath="..\XlsFormat\Logic\Biff_structures\PictFmlaKey.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\Biff_structures\PivotParsedFormula.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\Biff_structures\PivotParsedFormula.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\Biff_structures\PropertyBag.cpp"
|
||||
>
|
||||
|
||||
@ -416,6 +416,14 @@
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_package.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_pivot_cache_context.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_pivot_cache_context.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_tablecontext.cpp"
|
||||
>
|
||||
|
||||
@ -1148,6 +1148,7 @@ namespace NSFile
|
||||
|
||||
#if defined(__linux__) || defined(_MAC) && !defined(_IOS)
|
||||
char buf[NS_FILE_MAX_PATH];
|
||||
memset(buf, 0, NS_FILE_MAX_PATH);
|
||||
if (readlink ("/proc/self/exe", buf, NS_FILE_MAX_PATH) <= 0)
|
||||
{
|
||||
#ifdef _MAC
|
||||
|
||||
@ -1205,6 +1205,9 @@ namespace NSDoctRenderer
|
||||
|
||||
bool ExecuteCommand(const std::wstring& command)
|
||||
{
|
||||
if (command.length() < 7) // minimum command (!!!)
|
||||
return true;
|
||||
|
||||
Init();
|
||||
|
||||
if (-1 == m_nFileType)
|
||||
|
||||
@ -860,13 +860,26 @@ namespace NExtractTools
|
||||
|
||||
NSDirectory::CreateDirectory(sResultPptxDir);
|
||||
|
||||
int nRes = ppt2pptx_dir(sFrom, sResultPptxDir, sTemp, params);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
int hRes = ppt2pptx_dir(sFrom, sResultPptxDir, sTemp, params);
|
||||
|
||||
if(SUCCEEDED_X2T(hRes))
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultPptxDir, sTo, true))
|
||||
return 0;
|
||||
}
|
||||
else if (AVS_ERROR_DRM == hRes)
|
||||
{
|
||||
if(!params.getDontSaveAdditional())
|
||||
{
|
||||
copyOrigin(sFrom, *params.m_sFileTo);
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
|
||||
}
|
||||
else if (AVS_ERROR_PASSWORD == hRes)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
@ -874,7 +887,22 @@ namespace NExtractTools
|
||||
COfficePPTFile pptFile;
|
||||
|
||||
pptFile.put_TempDirectory(sTemp);
|
||||
return S_OK == pptFile.LoadFromFile(sFrom, sTo, params.getPassword()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword());
|
||||
|
||||
if (AVS_ERROR_DRM == hRes)
|
||||
{
|
||||
if(!params.getDontSaveAdditional())
|
||||
{
|
||||
copyOrigin(sFrom, *params.m_sFileTo);
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
|
||||
}
|
||||
else if (AVS_ERROR_PASSWORD == hRes)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
}
|
||||
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// ppt -> pptt
|
||||
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
@ -905,22 +933,36 @@ namespace NExtractTools
|
||||
|
||||
pptFile.put_TempDirectory(sTemp);
|
||||
|
||||
if ( pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword()) != S_OK) return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword());
|
||||
|
||||
// convert unzipped pptx to unzipped pptt
|
||||
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
// convert unzipped pptx to unzipped pptt
|
||||
CPPTXFile *pptx_file = new CPPTXFile(NULL, NULL, NULL, NULL);
|
||||
|
||||
int nRes = 0;
|
||||
if (pptx_file)
|
||||
{
|
||||
pptx_file->SetFontDir (params.getFontPath());
|
||||
nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
if (pptx_file)
|
||||
{
|
||||
pptx_file->SetFontDir (params.getFontPath());
|
||||
nRes = (S_OK == pptx_file->OpenFileToPPTY (sTempUnpackedPPTX, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
delete pptx_file;
|
||||
}
|
||||
return nRes;
|
||||
|
||||
delete pptx_file;
|
||||
}
|
||||
|
||||
return nRes;
|
||||
}
|
||||
else if (AVS_ERROR_DRM == nRes)
|
||||
{
|
||||
if(!params.getDontSaveAdditional())
|
||||
{
|
||||
copyOrigin(sFrom, *params.m_sFileTo);
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
|
||||
}
|
||||
else if (AVS_ERROR_PASSWORD == nRes)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
// pptx -> odp
|
||||
|
||||
@ -138,13 +138,15 @@ static std::wstring utf8_to_unicode(const char *src)
|
||||
InputParams oInputParams;
|
||||
oInputParams.m_sFileFrom = new std::wstring(sArg1);
|
||||
oInputParams.m_sFileTo = new std::wstring(sArg2);
|
||||
oInputParams.m_sPassword = new std::wstring(L"password");
|
||||
|
||||
// get conversion direction from 3rd argument
|
||||
if (argc > 3)
|
||||
{
|
||||
oInputParams.m_sFontDir = new std::wstring(sArg3);
|
||||
}
|
||||
if (argc > 4)
|
||||
{
|
||||
oInputParams.m_sPassword = new std::wstring(sArg4);
|
||||
}
|
||||
result = NExtractTools::fromInputParams(oInputParams);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user