mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-13 11:25:56 +08:00
Compare commits
46 Commits
core/devel
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| 29dc0aee32 | |||
| d805972d6d | |||
| 549d5a46a6 | |||
| 771bf2d55c | |||
| 3c58cd96fc | |||
| e50864fa98 | |||
| c8c0924c74 | |||
| af732e4e85 | |||
| 47ffdae8cc | |||
| fd5870083b | |||
| 5ba62cb25d | |||
| 79e0588544 | |||
| a3d08cfc35 | |||
| 5caccb284a | |||
| ce19969b52 | |||
| 0f91dc392e | |||
| e9805cef30 | |||
| e3e05eb2db | |||
| c09f17cffb | |||
| ce73dd5987 | |||
| 77df8aacb9 | |||
| ce45b2802f | |||
| 7886018d6f | |||
| 5b5cb4188e | |||
| f797af5f17 | |||
| 055977535e | |||
| 6ab24f10f0 | |||
| 12a03da231 | |||
| cb7088979a | |||
| 1fb1fc6c97 | |||
| e633c3c5d1 | |||
| 0f04de34b1 | |||
| 3f8c2c293a | |||
| 2c97e743da | |||
| 2c83860c04 | |||
| c64b624de2 | |||
| 5e3990937d | |||
| 21744c1607 | |||
| 0892e2549f | |||
| cff6f305d4 | |||
| 5060071227 | |||
| d64109eaa4 | |||
| ec064bbd50 | |||
| ec4f4fe476 | |||
| 634509ae28 | |||
| 8197fb8900 |
@ -178,7 +178,9 @@ namespace BinXlsxRW{
|
||||
{
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
|
||||
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
|
||||
|
||||
writeChartXlsx(sXlsxPath, oChartSpace);
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rId;
|
||||
|
||||
@ -307,6 +307,7 @@ namespace
|
||||
content << L"<w:" << Node << L"s \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
|
||||
@ -191,6 +191,12 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
}
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
|
||||
if (impl_->commentsId_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
//CP_XML_NODE(L"rowBreaks){}
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include "office_presentation.h"
|
||||
#include "draw_page.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.start_office_text();
|
||||
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
pages_[i]->docx_convert(Context);
|
||||
}
|
||||
Context.end_office_text();
|
||||
}
|
||||
@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_office_spreadsheet(this);
|
||||
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
pages_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_office_spreadsheet();
|
||||
}
|
||||
@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
|
||||
for (size_t i = 0; i < footer_decls_.size(); i++)
|
||||
{
|
||||
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
|
||||
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, elm);
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
|
||||
}
|
||||
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
|
||||
{
|
||||
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
|
||||
for (size_t i = 0; i < date_time_decls_.size(); i++)
|
||||
{
|
||||
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, elm);
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
|
||||
}
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
pages_[i]->pptx_convert(Context);
|
||||
}
|
||||
Context.end_office_presentation();
|
||||
}
|
||||
|
||||
@ -602,17 +602,24 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
|
||||
bool bLine = odf_context()->drawing_context()->isLineShape();
|
||||
|
||||
if (!bLine)
|
||||
if (custGeom && !custGeom->cxnLst.empty())
|
||||
bLine = true;
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
{
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
if (bLine)
|
||||
{
|
||||
odf_context()->drawing_context()->set_no_fill();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oox_spPr->Fill.is_init())
|
||||
convert(&oox_spPr->Fill);
|
||||
else if (oox_sp_style)
|
||||
convert(&oox_sp_style->fillRef, 1);
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
|
||||
odf_context()->drawing_context()->start_line_properties();
|
||||
{
|
||||
|
||||
@ -72,6 +72,7 @@ using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
{
|
||||
current_clrMap = NULL;
|
||||
@ -342,7 +343,7 @@ void PptxConverter::convert_slides()
|
||||
current_slide = slide->Master.operator->();
|
||||
|
||||
if (bShowLayoutMasterSp && bShowMasterSp)
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true, Master);
|
||||
else
|
||||
convert(slide->Master->cSld.bg.GetPointer());
|
||||
|
||||
@ -350,7 +351,7 @@ void PptxConverter::convert_slides()
|
||||
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
current_slide = slide->Layout.operator->();
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, Layout);
|
||||
|
||||
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
|
||||
else convert (slide->Master->transition.GetPointer());
|
||||
@ -402,7 +403,7 @@ void PptxConverter::convert_slides()
|
||||
odp_context->current_slide().set_master_page (master_style_name);
|
||||
odp_context->current_slide().set_layout_page (layout_style_name);
|
||||
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, Slide);
|
||||
convert (slide->comments.operator->());
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
@ -435,7 +436,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
|
||||
|
||||
odf_context()->page_layout_context()->set_page_size(width, height);
|
||||
}
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, NotesMaster);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -468,7 +469,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
|
||||
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
|
||||
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -1312,13 +1313,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
|
||||
}
|
||||
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
|
||||
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
|
||||
|
||||
//необязательно
|
||||
//if (page_props->content_.common_draw_fill_attlist_.draw_fill_image_name_)
|
||||
//{
|
||||
// page_props->content_.draw_background_size_ = L"border";
|
||||
//}
|
||||
|
||||
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
|
||||
|
||||
odp_context->end_drawings();
|
||||
}
|
||||
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type)
|
||||
{
|
||||
if (oox_slide == NULL) return;
|
||||
|
||||
@ -1328,7 +1335,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
if (oox_slide->attrName.IsInit())
|
||||
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
|
||||
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
if (type != Notes && type != NotesMaster)
|
||||
{
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
|
||||
{
|
||||
@ -1348,7 +1358,7 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
{
|
||||
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
continue;
|
||||
|
||||
odf_context()->drawing_context()->set_placeholder_type(ph_type);
|
||||
|
||||
@ -100,6 +100,14 @@ using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
enum _typePages
|
||||
{
|
||||
Slide,
|
||||
Master,
|
||||
Layout,
|
||||
NotesMaster,
|
||||
Notes
|
||||
};
|
||||
class PptxConverter : public OoxConverter
|
||||
{
|
||||
public:
|
||||
@ -119,7 +127,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert (PPTX::Comments *oox_comments);
|
||||
void convert (PPTX::NotesSlide *oox_notes);
|
||||
|
||||
@ -282,6 +282,12 @@ namespace NSBinPptxRW
|
||||
m_pContentTypes->AddDefault(strExts.substr(1));
|
||||
}
|
||||
|
||||
if (oleData.empty() == false)
|
||||
{
|
||||
//plugins data - generate ole
|
||||
typeAdditional = 1;
|
||||
}
|
||||
|
||||
_imageManager2Info oImageManagerInfo = GenerateImageExec(strImage, strExts, strAdditional, typeAdditional, oleData);
|
||||
|
||||
if (!oImageManagerInfo.sFilepathAdditional.empty())
|
||||
@ -346,8 +352,11 @@ namespace NSBinPptxRW
|
||||
{
|
||||
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
|
||||
|
||||
if (oPathOutput.GetPath() != strInput)
|
||||
CDirectory::CopyFile(strInput, oPathOutput.GetPath());
|
||||
if (oPathOutput.GetPath() != strInput && NSFile::CFileBinary::Exists(strInput))
|
||||
{
|
||||
NSFile::CFileBinary::Copy(strInput, oPathOutput.GetPath());
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -355,8 +364,8 @@ namespace NSBinPptxRW
|
||||
strExts = _T(".png");
|
||||
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
|
||||
SaveImageAsPng(strInput, oPathOutput.GetPath());
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
}
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
|
||||
if ((!strAdditionalImage.empty() || !oleData.empty() ) && (nAdditionalType == 1))
|
||||
{
|
||||
@ -374,13 +383,14 @@ namespace NSBinPptxRW
|
||||
if(!oleData.empty())
|
||||
{
|
||||
WriteOleData(strAdditionalImageOut, oleData);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
else
|
||||
else if (NSFile::CFileBinary::Exists(strAdditionalImage))
|
||||
{
|
||||
CDirectory::CopyFile(strAdditionalImage, strAdditionalImageOut);
|
||||
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
else if (!strAdditionalImage.empty() && nAdditionalType == 2)
|
||||
{
|
||||
@ -395,8 +405,11 @@ namespace NSBinPptxRW
|
||||
|
||||
std::wstring strAdditionalImageOut = pathOutput.GetPath();
|
||||
|
||||
CDirectory::CopyFile(strAdditionalImage, strAdditionalImageOut);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
if (NSFile::CFileBinary::Exists(strAdditionalImage))
|
||||
{
|
||||
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
}
|
||||
|
||||
return oImageManagerInfo;
|
||||
@ -1236,24 +1249,28 @@ namespace NSBinPptxRW
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strImageRelsPath = L"media/";
|
||||
else strImageRelsPath = L"../media/";
|
||||
|
||||
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
|
||||
|
||||
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
_relsGeneratorInfo oRelsGeneratorInfo;
|
||||
|
||||
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
|
||||
if (!oImageManagerInfo.sFilepathImage.empty())
|
||||
{
|
||||
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
}
|
||||
|
||||
if(additionalFile.is<OOX::OleObject>())
|
||||
{
|
||||
@ -1285,7 +1302,7 @@ namespace NSBinPptxRW
|
||||
}
|
||||
}
|
||||
}
|
||||
if(additionalFile.is<OOX::Media>())
|
||||
else if(additionalFile.is<OOX::Media>())
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
|
||||
|
||||
@ -187,8 +187,25 @@ namespace PPTX
|
||||
break;
|
||||
}
|
||||
case BULLET_TYPE_BULLET_BLIP:
|
||||
// TODO:
|
||||
break;
|
||||
{
|
||||
pReader->Skip(5); // len + type + start attr
|
||||
|
||||
Logic::BuBlip *pBuBlip = new Logic::BuBlip();
|
||||
pBuBlip->blip.fromPPTY(pReader);
|
||||
|
||||
if (pBuBlip->blip.embed.IsInit())
|
||||
{
|
||||
m_Bullet.reset(pBuBlip);
|
||||
}
|
||||
else
|
||||
{//??? сбой ???
|
||||
delete pBuBlip;
|
||||
|
||||
Logic::BuChar *pBuChar = new Logic::BuChar();
|
||||
pBuChar->Char = wchar_t(L'\x2022');
|
||||
m_Bullet.reset(pBuChar);
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
m_Bullet.reset(new Logic::BuNone());
|
||||
break;
|
||||
|
||||
@ -257,5 +257,129 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
void Blip::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
LONG _s2 = pReader->GetPos();
|
||||
LONG _e2 = _s2 + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1);
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
|
||||
break;
|
||||
|
||||
if (_at == 0)
|
||||
pReader->Skip(1);
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _e2)
|
||||
{
|
||||
BYTE _t = pReader->GetUChar();
|
||||
|
||||
switch (_t)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
// id. embed / link
|
||||
pReader->Skip(4);
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
{
|
||||
// id. embed / link
|
||||
pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pReader->Skip(4);
|
||||
ULONG count_effects = pReader->GetULong();
|
||||
for (ULONG _eff = 0; _eff < count_effects; ++_eff)
|
||||
{
|
||||
pReader->Skip(1); // type
|
||||
ULONG rec_len = pReader->GetULong();
|
||||
if (0 == rec_len)
|
||||
continue;
|
||||
|
||||
BYTE rec = pReader->GetUChar();
|
||||
|
||||
if (rec == EFFECT_TYPE_ALPHAMODFIX)
|
||||
{
|
||||
// alpha!!!
|
||||
LONG _e22 = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1); // startattr
|
||||
|
||||
PPTX::Logic::AlphaModFix* pEffect = new PPTX::Logic::AlphaModFix();
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
|
||||
break;
|
||||
|
||||
if (_at == 0)
|
||||
pEffect->amt = pReader->GetLong();
|
||||
}
|
||||
|
||||
Effects.push_back(UniEffect());
|
||||
Effects[0].InitPointer(pEffect);
|
||||
|
||||
pReader->Seek(_e22);
|
||||
}
|
||||
else
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pReader->Skip(6); // len + start attributes + type
|
||||
|
||||
std::wstring strImagePath = pReader->GetString2();
|
||||
|
||||
if (0 != strImagePath.find(_T("http:")) &&
|
||||
0 != strImagePath.find(_T("https:")) &&
|
||||
0 != strImagePath.find(_T("ftp:")) &&
|
||||
0 != strImagePath.find(_T("file:")))
|
||||
{
|
||||
if (0 == strImagePath.find(_T("theme")))
|
||||
{
|
||||
strImagePath = pReader->m_strFolderExternalThemes + FILE_SEPARATOR_STR + strImagePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
strImagePath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strImagePath;
|
||||
}
|
||||
|
||||
OOX::CPath pathUrl = strImagePath;
|
||||
strImagePath = pathUrl.GetPath();
|
||||
}
|
||||
|
||||
smart_ptr<OOX::File> additionalFile;
|
||||
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, additionalFile, L"", L"");
|
||||
|
||||
if (oRelsGeneratorInfo.nImageRId > 0)
|
||||
{
|
||||
embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
|
||||
}
|
||||
pReader->Skip(1); // end attribute
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_e2);
|
||||
}
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
@ -91,6 +91,7 @@ namespace PPTX
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
|
||||
|
||||
virtual std::wstring GetFullPicName(OOX::IFileContainer* pRels = NULL)const;
|
||||
virtual std::wstring GetFullOleName(const OOX::RId& pRId, OOX::IFileContainer* pRels = NULL)const;
|
||||
|
||||
@ -447,7 +447,10 @@ namespace PPTX
|
||||
if (!blip.is_init())
|
||||
blip = new PPTX::Logic::Blip();
|
||||
|
||||
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
|
||||
if (oRelsGeneratorInfo.nImageRId > 0)
|
||||
{
|
||||
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
|
||||
}
|
||||
|
||||
if(oRelsGeneratorInfo.nOleRId > 0)
|
||||
{
|
||||
|
||||
@ -1136,8 +1136,18 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
|
||||
if (spPr.Geometry.is_init())
|
||||
bool bRect = bOle; //ole ВСЕГДА rect
|
||||
|
||||
if (spPr.Geometry.is<PPTX::Logic::PrstGeom>())
|
||||
{
|
||||
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
|
||||
if( lpGeom.prst.get() == L"rect" )
|
||||
bRect = true;
|
||||
}
|
||||
|
||||
if (bRect == false)
|
||||
{//custom vml shape
|
||||
std::wstring strPath;
|
||||
std::wstring strTextRect;
|
||||
|
||||
@ -1324,7 +1334,9 @@ namespace PPTX
|
||||
}
|
||||
if(oleObject->m_oId.IsInit())
|
||||
{
|
||||
blipFill.blip->oleRid = oleObject->m_oId.get().ToString();
|
||||
if (blipFill.blip.IsInit() == false)
|
||||
blipFill.blip.Init();
|
||||
blipFill.blip->oleRid = oleObject->m_oId->get();
|
||||
}
|
||||
}
|
||||
} // namespace Logic
|
||||
|
||||
@ -409,7 +409,6 @@ namespace PPTX
|
||||
|
||||
pWriter->StartRecord(4);
|
||||
pWriter->m_pMainDocument->getBinaryContentElem(OOX::et_w_sdtContent, oTextBoxShape.GetPointer(), *pWriter, lDataSize);
|
||||
//pWriter->m_pMainDocument->getBinaryContent(TextBoxShape.get(), *pWriter, lDataSize);
|
||||
pWriter->EndRecord();
|
||||
|
||||
if (oTextBoxBodyPr.is_init())
|
||||
@ -419,6 +418,24 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
}
|
||||
else if (strTextBoxShape.is_init())//после конвертации старого шейпа (vml)
|
||||
{
|
||||
long lDataSize = 0;
|
||||
ULONG lPos = pWriter->GetPosition();
|
||||
pWriter->SetPosition(lPos);
|
||||
|
||||
pWriter->StartRecord(4);
|
||||
pWriter->m_pMainDocument->getBinaryContent(strTextBoxShape.get(), *pWriter, lDataSize);
|
||||
pWriter->EndRecord();
|
||||
|
||||
if (oTextBoxBodyPr.is_init())
|
||||
{
|
||||
pWriter->StartRecord(5);
|
||||
oTextBoxBodyPr->toPPTY(pWriter);
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
}
|
||||
|
||||
else if (txBody.is_init())
|
||||
{
|
||||
std::wstring strContent = txBody->GetDocxTxBoxContent(pWriter, style);
|
||||
@ -553,7 +570,7 @@ namespace PPTX
|
||||
std::wstring strFillNode;
|
||||
std::wstring strStrokeNode;;
|
||||
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle, bSignature);
|
||||
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle, bSignature);
|
||||
|
||||
pWriter->StartNode(L"v:shape");
|
||||
|
||||
@ -59,7 +59,7 @@ namespace PPTX
|
||||
}
|
||||
|
||||
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
|
||||
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
|
||||
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
|
||||
{
|
||||
PPTX::Logic::UniFill fill;
|
||||
DWORD ARGB = 0;
|
||||
@ -113,7 +113,7 @@ namespace PPTX
|
||||
|
||||
std::wstring strId = oBlip.blip->embed->ToString();
|
||||
|
||||
if(bOle)
|
||||
if (bOle || bSignature)
|
||||
{
|
||||
strAttr = _T(" filled=\"f\"");
|
||||
strNode = _T("<v:imagedata r:id=\"") + strId + _T("\" o:title=\"\" />");
|
||||
|
||||
@ -44,7 +44,7 @@ namespace PPTX
|
||||
namespace Logic
|
||||
{
|
||||
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
|
||||
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
|
||||
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
|
||||
|
||||
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
|
||||
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "FixedPoint.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
//#include <Exception/AttributeDataWrong.h>
|
||||
|
||||
namespace OSHARED
|
||||
{
|
||||
@ -40,8 +39,14 @@ namespace OSHARED
|
||||
|
||||
FixedPoint::FixedPoint()
|
||||
{
|
||||
Integral = 0;
|
||||
Fractional = 0;
|
||||
}
|
||||
FixedPoint::FixedPoint(unsigned short cbElement_)
|
||||
{
|
||||
Integral = 0;
|
||||
Fractional = 0;
|
||||
}
|
||||
|
||||
|
||||
FixedPoint::FixedPoint(const int raw_data)
|
||||
{
|
||||
@ -49,7 +54,6 @@ FixedPoint::FixedPoint(const int raw_data)
|
||||
Integral = static_cast<unsigned char>(raw_data >> 16);
|
||||
}
|
||||
|
||||
|
||||
XLS::BiffStructurePtr FixedPoint::clone()
|
||||
{
|
||||
return XLS::BiffStructurePtr(new FixedPoint(*this));
|
||||
|
||||
@ -41,6 +41,7 @@ class CFRecord;
|
||||
class FixedPoint : public XLS::BiffAttribute
|
||||
{
|
||||
public:
|
||||
FixedPoint(unsigned short cbElement_); //fixed always!!
|
||||
FixedPoint();
|
||||
FixedPoint(const int raw_data);
|
||||
XLS::BiffStructurePtr clone();
|
||||
|
||||
@ -56,8 +56,11 @@ public:
|
||||
unsigned short nElems, nElemsAlloc;
|
||||
unsigned short cbElem;
|
||||
|
||||
int pos1 = record.getRdPtr();
|
||||
|
||||
record >> nElems >> nElemsAlloc >> cbElem;
|
||||
while(nElems--)
|
||||
|
||||
for (unsigned short i = 0; i < nElems; i++)
|
||||
{
|
||||
Type element(cbElem);
|
||||
record >> element;
|
||||
|
||||
@ -223,18 +223,26 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
|
||||
fopte = OfficeArtFOPTEPtr(new AdjustValue);
|
||||
break;
|
||||
case 0x0151:
|
||||
fopte = OfficeArtFOPTEPtr(new pConnectionSites);
|
||||
break;
|
||||
case 0x0152:
|
||||
fopte = OfficeArtFOPTEPtr(new pConnectionSitesDir);
|
||||
break;
|
||||
case 0x0153:
|
||||
case 0x0154:
|
||||
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
|
||||
break;
|
||||
case 0x0155:
|
||||
fopte = OfficeArtFOPTEPtr(new pAdjustHandles);
|
||||
break;
|
||||
case 0x0156:
|
||||
fopte = OfficeArtFOPTEPtr(new pGuides);
|
||||
break;
|
||||
case 0x0152:
|
||||
case 0x0153:
|
||||
case 0x0154:
|
||||
case 0x0155:
|
||||
case 0x0157:
|
||||
fopte = OfficeArtFOPTEPtr(new pInscribe);
|
||||
break;
|
||||
case 0x0158:
|
||||
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
|
||||
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);//cxk
|
||||
break;
|
||||
case 0x017f:
|
||||
fopte = OfficeArtFOPTEPtr(new GeometryBooleanProperties);
|
||||
@ -427,6 +435,14 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
|
||||
|
||||
return fopte;
|
||||
}
|
||||
FixedPoint::FixedPoint()
|
||||
{
|
||||
dVal = 0;
|
||||
}
|
||||
FixedPoint::FixedPoint(unsigned short cbElement_)
|
||||
{
|
||||
dVal = 0;
|
||||
}
|
||||
void FixedPoint::load(XLS::CFRecord& record)
|
||||
{
|
||||
OfficeArtFOPTE::load(record);
|
||||
@ -642,17 +658,6 @@ void pihlShape::ReadComplexData(XLS::CFRecord& record)
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
|
||||
int pos2 = record.getRdPtr() - pos;
|
||||
|
||||
if (pos2 > 0 && pos2 < op)
|
||||
{
|
||||
record.skipNunBytes(op - pos2);
|
||||
}
|
||||
if (pos2 > 0 && pos2 > op)
|
||||
{
|
||||
record.RollRdPtrBack( pos2 - op);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------
|
||||
MSOPOINT::MSOPOINT()
|
||||
@ -691,6 +696,44 @@ void MSOPOINT::load(XLS::CFRecord& record)
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------
|
||||
MSORECT::MSORECT()
|
||||
{
|
||||
cbElement = 8;
|
||||
}
|
||||
|
||||
MSORECT::MSORECT(unsigned short cbElement_)
|
||||
{
|
||||
cbElement = 8;
|
||||
|
||||
if (cbElement_ == 0xfff0)
|
||||
{
|
||||
cbElement = 4;
|
||||
}
|
||||
}
|
||||
|
||||
XLS::BiffStructurePtr MSORECT::clone()
|
||||
{
|
||||
return XLS::BiffStructurePtr(new MSORECT(*this));
|
||||
}
|
||||
|
||||
void MSORECT::load(XLS::CFRecord& record)
|
||||
{
|
||||
if (cbElement == 8)
|
||||
{
|
||||
record >> l >> t >> r >> b;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short l_, t_, r_, b_;
|
||||
record >> l_ >> t_ >> r_ >> b_;
|
||||
|
||||
l = l_;
|
||||
t = t_;
|
||||
r = r_;
|
||||
b = b_;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------
|
||||
MSOPATHINFO::MSOPATHINFO()
|
||||
{
|
||||
cbElement = 4;
|
||||
@ -926,17 +969,6 @@ void PVertices::ReadComplexData(XLS::CFRecord& record)
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
|
||||
int pos2 = record.getRdPtr() - pos;
|
||||
|
||||
if (pos2 > 0 && pos2 < op)
|
||||
{
|
||||
record.skipNunBytes(op - pos2);
|
||||
}
|
||||
if (pos2 > 0 && pos2 > op)
|
||||
{
|
||||
record.RollRdPtrBack( pos2 - op);
|
||||
}
|
||||
}
|
||||
|
||||
void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
|
||||
@ -945,17 +977,6 @@ void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
|
||||
int pos2 = record.getRdPtr() - pos;
|
||||
|
||||
if (pos2 > 0 && pos2 < op)
|
||||
{
|
||||
record.skipNunBytes(op - pos2);
|
||||
}
|
||||
if (pos2 > 0 && pos2 > op)
|
||||
{
|
||||
record.RollRdPtrBack( pos2 - op);
|
||||
}
|
||||
}
|
||||
|
||||
void pGuides::ReadComplexData(XLS::CFRecord& record)
|
||||
@ -964,17 +985,6 @@ void pGuides::ReadComplexData(XLS::CFRecord& record)
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
|
||||
int pos2 = record.getRdPtr() - pos;
|
||||
|
||||
if (pos2 > 0 && pos2 < op)
|
||||
{
|
||||
record.skipNunBytes(op - pos2);
|
||||
}
|
||||
if (pos2 > 0 && pos2 > op)
|
||||
{
|
||||
record.RollRdPtrBack( pos2 - op);
|
||||
}
|
||||
}
|
||||
void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
|
||||
{
|
||||
@ -983,16 +993,26 @@ void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
}
|
||||
void pConnectionSites::ReadComplexData(XLS::CFRecord& record)
|
||||
{
|
||||
complex.op = op;
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
int pos2 = record.getRdPtr() - pos;
|
||||
record >> complex;
|
||||
}
|
||||
void pConnectionSitesDir::ReadComplexData(XLS::CFRecord& record)
|
||||
{
|
||||
complex.op = op;
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
if (pos2 > 0 && pos2 < op)
|
||||
{
|
||||
record.skipNunBytes(op - pos2);
|
||||
}
|
||||
if (pos2 > 0 && pos2 > op)
|
||||
{
|
||||
record.RollRdPtrBack( pos2 - op);
|
||||
}
|
||||
record >> complex;
|
||||
}
|
||||
void pInscribe::ReadComplexData(XLS::CFRecord& record)
|
||||
{
|
||||
complex.op = op;
|
||||
int pos = record.getRdPtr();
|
||||
|
||||
record >> complex;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,10 @@ class fillColor : public OfficeArtFOPTE
|
||||
|
||||
class FixedPoint : public OfficeArtFOPTE
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(fillColor)
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(FixedPoint)
|
||||
|
||||
FixedPoint();
|
||||
FixedPoint(unsigned short cbElement_); //fixed always!!
|
||||
virtual void load(XLS::CFRecord& record);
|
||||
|
||||
double dVal;
|
||||
@ -574,6 +577,28 @@ class MSOPOINT : public XLS::BiffStructure
|
||||
int cbElement;
|
||||
};
|
||||
|
||||
class MSORECT : public XLS::BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSORECT)
|
||||
|
||||
MSORECT(unsigned short cbElement_);
|
||||
MSORECT();
|
||||
|
||||
XLS::BiffStructurePtr clone();
|
||||
|
||||
virtual void load(XLS::CFRecord& record);
|
||||
|
||||
static const XLS::ElementType type = XLS::typeOfficeArtRecord;
|
||||
|
||||
_INT32 l;
|
||||
_INT32 t;
|
||||
_INT32 r;
|
||||
_INT32 b;
|
||||
|
||||
int cbElement;
|
||||
};
|
||||
|
||||
|
||||
class MSOPATHINFO : public XLS::BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSOPATHINFO)
|
||||
@ -710,6 +735,40 @@ class pAdjustHandles : public OfficeArtFOPTE
|
||||
IMsoArray<ADJH> complex;
|
||||
};
|
||||
|
||||
class pConnectionSites : public OfficeArtFOPTE
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSites)
|
||||
|
||||
virtual void ReadComplexData(XLS::CFRecord& record);
|
||||
|
||||
IMsoArray<MSOPOINT> complex;
|
||||
};
|
||||
|
||||
class pConnectionSitesDir : public OfficeArtFOPTE
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSitesDir)
|
||||
|
||||
virtual void ReadComplexData(XLS::CFRecord& record);
|
||||
|
||||
IMsoArray<ODRAW::FixedPoint> complex;
|
||||
};
|
||||
|
||||
class pInscribe : public OfficeArtFOPTE
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(pInscribe)
|
||||
|
||||
virtual void ReadComplexData(XLS::CFRecord& record);
|
||||
|
||||
IMsoArray<MSORECT> complex;
|
||||
};
|
||||
//class cxk : public OfficeArtFOPTE
|
||||
//{
|
||||
// BASE_STRUCTURE_DEFINE_CLASS_NAME(cxk)
|
||||
//
|
||||
// virtual void ReadComplexData(XLS::CFRecord& record);
|
||||
//
|
||||
// IMsoArray<MSOCXK> complex;
|
||||
//};
|
||||
class lineOpacity : public OfficeArtFOPTE
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(lineOpacity)
|
||||
|
||||
@ -221,7 +221,7 @@ int CELL_GROUP::serialize(std::wostream & stream)
|
||||
CP_XML_ATTR(L"customFormat", true);
|
||||
}
|
||||
}
|
||||
if (row->miyRw > 0/* && std::abs(row->miyRw/20. - sheet_info.defaultRowHeight) > 0.01*/)
|
||||
if (row->miyRw > 0 && row->miyRw < 0x8000) //v8_14A_1b13.xls
|
||||
{
|
||||
CP_XML_ATTR(L"ht", row->miyRw / 20.);
|
||||
CP_XML_ATTR(L"customHeight", true);
|
||||
|
||||
@ -115,30 +115,30 @@ public:
|
||||
m_strRect = Shape->m_strRect;
|
||||
|
||||
m_arAdjustments.clear();
|
||||
for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arAdjustments.size(); i++)
|
||||
m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
|
||||
|
||||
m_arGuides.clear();
|
||||
for(int i = 0; i < Shape->m_arGuides.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arGuides.size(); i++)
|
||||
m_arGuides.push_back(Shape->m_arGuides[i]);
|
||||
|
||||
m_eJoin = Shape->m_eJoin;
|
||||
m_bConcentricFill = Shape->m_bConcentricFill;
|
||||
|
||||
m_arConnectors.clear();
|
||||
for(int i = 0; i < Shape->m_arConnectors.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arConnectors.size(); i++)
|
||||
m_arConnectors.push_back(Shape->m_arConnectors[i]);
|
||||
|
||||
m_arConnectorAngles.clear();
|
||||
for(int i = 0; i < Shape->m_arConnectorAngles.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arConnectorAngles.size(); i++)
|
||||
m_arConnectorAngles.push_back(Shape->m_arConnectorAngles[i]);
|
||||
|
||||
m_arTextRects.clear();
|
||||
for(int i = 0; i < Shape->m_arTextRects.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arTextRects.size(); i++)
|
||||
m_arTextRects.push_back(Shape->m_arTextRects[i]);
|
||||
|
||||
m_arHandles.clear();
|
||||
for(int i = 0; i < Shape->m_arHandles.size(); i++)
|
||||
for(size_t i = 0; i < Shape->m_arHandles.size(); i++)
|
||||
m_arHandles.push_back(Shape->m_arHandles[i]);
|
||||
|
||||
|
||||
@ -157,26 +157,26 @@ public:
|
||||
// Shape->m_strRect = m_strRect;
|
||||
//
|
||||
// Shape->m_arAdjustments.clear();
|
||||
// for(int i = 0; i < m_arAdjustments.size(); i++)
|
||||
// for(size_t i = 0; i < m_arAdjustments.size(); i++)
|
||||
// Shape->m_arAdjustments.push_back(m_arAdjustments[i]);
|
||||
|
||||
// Shape->Guides.clear();
|
||||
// for(int i = 0; i < Guides.size(); i++)
|
||||
// for(size_t i = 0; i < Guides.size(); i++)
|
||||
// Shape->Guides.push_back(Guides[i]);
|
||||
|
||||
// Shape->m_eJoin = m_eJoin;
|
||||
// Shape->m_bConcentricFill = m_bConcentricFill;
|
||||
|
||||
// Shape->m_arConnectors.clear();
|
||||
// for(int i = 0; i < m_arConnectors.size(); i++)
|
||||
// for(size_t i = 0; i < m_arConnectors.size(); i++)
|
||||
// Shape->m_arConnectors.push_back(m_arConnectors[i]);
|
||||
|
||||
// Shape->m_arConnectorAngles.clear();
|
||||
// for(int i = 0; i < m_arConnectorAngles.size(); i++)
|
||||
// for(size_t i = 0; i < m_arConnectorAngles.size(); i++)
|
||||
// Shape->m_arConnectorAngles.push_back(m_arConnectorAngles[i]);
|
||||
|
||||
// Shape->m_arTextRects.clear();
|
||||
// for(int i = 0; i < m_arTextRects.size(); i++)
|
||||
// for(size_t i = 0; i < m_arTextRects.size(); i++)
|
||||
// Shape->m_arTextRects.push_back(m_arTextRects[i]);
|
||||
// Shape->m_strRect = m_strRect;
|
||||
|
||||
|
||||
@ -351,12 +351,12 @@ private:
|
||||
m_lShapeHeight = oSrc.m_lShapeHeight;
|
||||
|
||||
m_arResults.clear();
|
||||
for (int nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
|
||||
{
|
||||
m_arResults.push_back(oSrc.m_arResults[nIndex]);
|
||||
}
|
||||
m_arFormulas.clear();
|
||||
for (int nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
|
||||
{
|
||||
m_arFormulas.push_back(oSrc.m_arFormulas[nIndex]);
|
||||
}
|
||||
@ -379,7 +379,7 @@ private:
|
||||
|
||||
//m_arFormulas.clear();
|
||||
//m_arResults.clear();
|
||||
for (int nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
|
||||
{
|
||||
m_arResults[nIndex] = 0xFFFFFFFF;
|
||||
}
|
||||
@ -399,7 +399,7 @@ private:
|
||||
}
|
||||
void CalculateResults()
|
||||
{
|
||||
for (int index = 0; index < m_arFormulas.size(); ++index)
|
||||
for (size_t index = 0; index < m_arFormulas.size(); ++index)
|
||||
{
|
||||
LONG lResult = m_arFormulas[index].CalculateFormula(this);
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
m_eType = oSrc.m_eType;
|
||||
this->m_arPoints.clear();
|
||||
for (int nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
|
||||
for (size_t nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
|
||||
{
|
||||
this->m_arPoints.push_back(oSrc.m_arPoints[nIndex]);
|
||||
}
|
||||
@ -771,7 +771,7 @@ namespace NSCustomShapesConvert
|
||||
case rtAngleEllipseTo:
|
||||
{
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 3) <= this->m_arPoints.size())
|
||||
while ((nFigure + 3) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
|
||||
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
|
||||
@ -790,7 +790,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
pRenderer->PathCommandStart();
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 3) <= this->m_arPoints.size())
|
||||
while ((nFigure + 3) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
|
||||
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
|
||||
@ -809,7 +809,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
pRenderer->PathCommandStart();
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 4) <= this->m_arPoints.size())
|
||||
while ((nFigure + 4) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
|
||||
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
|
||||
@ -834,7 +834,7 @@ namespace NSCustomShapesConvert
|
||||
case rtArcTo:
|
||||
{
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 4) <= this->m_arPoints.size())
|
||||
while ((nFigure + 4) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
|
||||
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
|
||||
@ -859,7 +859,7 @@ namespace NSCustomShapesConvert
|
||||
case rtClockwiseArcTo:
|
||||
{
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 4) <= this->m_arPoints.size())
|
||||
while ((nFigure + 4) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
|
||||
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
|
||||
@ -885,7 +885,7 @@ namespace NSCustomShapesConvert
|
||||
{
|
||||
pRenderer->PathCommandStart();
|
||||
int nFigure = 0;
|
||||
while ((nFigure + 4) <= this->m_arPoints.size())
|
||||
while ((nFigure + 4) <= (int)this->m_arPoints.size())
|
||||
{
|
||||
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
|
||||
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
|
||||
|
||||
@ -332,7 +332,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
convert((XLS::GlobalsSubstream*)woorkbook->m_GlobalsSubstream.get());
|
||||
|
||||
int count_sheets = 0, count_chart_sheets = 0;
|
||||
for (int i=0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
|
||||
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
|
||||
{
|
||||
if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream)
|
||||
{
|
||||
@ -406,14 +406,14 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
|
||||
{
|
||||
CP_XML_NODE(L"mergeCells")
|
||||
{
|
||||
for (int i = 0 ; i < sheet->m_arMergeCells.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arMergeCells.size(); i++)
|
||||
{
|
||||
sheet->m_arMergeCells[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0 ; i < sheet->m_arHLINK.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arHLINK.size(); i++)
|
||||
{
|
||||
convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
|
||||
}
|
||||
@ -438,7 +438,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
|
||||
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0);
|
||||
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0x0019);
|
||||
convert(dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get()));
|
||||
@ -452,7 +452,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
|
||||
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
{
|
||||
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
|
||||
}
|
||||
@ -463,7 +463,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
|
||||
{
|
||||
CP_XML_NODE(L"customSheetViews")
|
||||
{
|
||||
for (int i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
|
||||
{
|
||||
sheet->m_arCUSTOMVIEW[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -476,7 +476,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
|
||||
convert(dynamic_cast<XLS::BACKGROUND*>(sheet->m_BACKGROUND.get()));
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
{
|
||||
convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
|
||||
}
|
||||
@ -492,26 +492,26 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
|
||||
|
||||
convert((XLS::SHAREDSTRINGS*)global->m_SHAREDSTRINGS.get());
|
||||
|
||||
for (int i = 0 ; i < global->m_arLBL.size(); i++)
|
||||
for (size_t i = 0 ; i < global->m_arLBL.size(); i++)
|
||||
{
|
||||
convert((XLS::LBL*)global->m_arLBL[i].get());
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
|
||||
for (size_t i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
|
||||
{
|
||||
convert((XLS::MSODRAWINGGROUP*)global->m_arMSODRAWINGGROUP[i].get());
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
|
||||
for (size_t i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
|
||||
{
|
||||
convert((ODRAW::OfficeArtDgContainer*)global->m_arHFPictureDrawing[i].get());
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < global->m_arWindow1.size(); i++)
|
||||
for (size_t i = 0 ; i < global->m_arWindow1.size(); i++)
|
||||
{
|
||||
global->m_arWindow1[i]->serialize(xlsx_context->workbook_views());
|
||||
}
|
||||
for (int i = 0 ; i < global->m_arUserBView.size(); i++)
|
||||
for (size_t i = 0 ; i < global->m_arUserBView.size(); i++)
|
||||
{
|
||||
global->m_arUserBView[i]->serialize(xlsx_context->custom_views());
|
||||
}
|
||||
@ -544,7 +544,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
|
||||
}
|
||||
|
||||
CP_XML_ATTR(L"count", fills_out.size());
|
||||
for (int i = 0 ;i < fills_out.size(); i++)
|
||||
for (size_t i = 0 ;i < fills_out.size(); i++)
|
||||
{
|
||||
fills_out[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -560,7 +560,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
|
||||
}
|
||||
|
||||
CP_XML_ATTR(L"count", borders_out.size());
|
||||
for (int i = 0 ;i < borders_out.size(); i++)
|
||||
for (size_t i = 0 ;i < borders_out.size(); i++)
|
||||
{
|
||||
borders_out[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -740,7 +740,7 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star
|
||||
if (art_bstore == NULL) return;
|
||||
if (art_bstore->rgfb.size() < 1) return;
|
||||
|
||||
for (int i = 0 ; i < art_bstore->rgfb.size(); i++)
|
||||
for (size_t i = 0 ; i < art_bstore->rgfb.size(); i++)
|
||||
{
|
||||
int bin_id = i + start_id + 1;
|
||||
|
||||
@ -896,7 +896,7 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
|
||||
xlsx_context->get_drawing_context().set_line_old_version(obj->old_version.line);
|
||||
xlsx_context->get_drawing_context().set_flag_old_version(obj->old_version.flag, obj->old_version.flag2);
|
||||
|
||||
for (int i = 0 ; i < obj->old_version.additional.size(); i++)
|
||||
for (size_t i = 0 ; i < obj->old_version.additional.size(); i++)
|
||||
{
|
||||
convert(obj->old_version.additional[i].get());
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
|
||||
{
|
||||
text_obj->preserve_enabled = true;
|
||||
|
||||
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
{
|
||||
XLS::Note* note = dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get());
|
||||
if ((note) && (note->note_sh.idObj == obj->cmo.id))
|
||||
@ -1055,7 +1055,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpgrContainer * spgr)
|
||||
if (spgr == NULL) return;
|
||||
if (spgr->anchor_type_ != ODRAW::OfficeArtRecord::CA_HF) return; //todooo проверить что тока для header/footer это нужно
|
||||
|
||||
for (int i = 0; i < spgr->child_records.size(); i++)
|
||||
for (size_t i = 0; i < spgr->child_records.size(); i++)
|
||||
{
|
||||
int type_object = 2;//rect
|
||||
|
||||
@ -1076,7 +1076,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpContainer *sp, bool anchor_only)
|
||||
{
|
||||
convert(sp->m_OfficeArtFSP.get());
|
||||
|
||||
for (int i = 0; i < sp->child_records.size(); i++)
|
||||
for (size_t i = 0; i < sp->child_records.size(); i++)
|
||||
{
|
||||
convert(sp->child_records[i].get());
|
||||
}
|
||||
@ -1140,12 +1140,12 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
|
||||
{
|
||||
ODRAW::OfficeArtDgContainer * dg = dynamic_cast<ODRAW::OfficeArtDgContainer *>(art);
|
||||
|
||||
for (int i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
|
||||
for (size_t i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
|
||||
{
|
||||
convert(dg->child_records[i].get());
|
||||
}
|
||||
|
||||
for (int i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
|
||||
for (size_t i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
|
||||
{
|
||||
convert(dg->m_OfficeArtSpContainer[i].get());
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ void XlsConverter::convert(ODRAW::OfficeArtFSP * fsp)
|
||||
}
|
||||
void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1286,7 +1286,7 @@ void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
|
||||
{
|
||||
ODRAW::fillShadeColors *shadeColors = (ODRAW::fillShadeColors *)(props[i].get());
|
||||
|
||||
for (int i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
|
||||
for (size_t i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
|
||||
{
|
||||
ODRAW::OfficeArtCOLORREF & color = shadeColors->fillShadeColors_complex.data[i].color;
|
||||
|
||||
@ -1325,7 +1325,7 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
|
||||
{
|
||||
if (props.size() < 1) return;
|
||||
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1403,6 +1403,18 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case NSOfficeDrawing::lineMiterLimit:
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_line_miter(props[i]->op);
|
||||
}break;
|
||||
case NSOfficeDrawing::lineJoinStyle:
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_line_join(props[i]->op);
|
||||
}break;
|
||||
case NSOfficeDrawing::lineEndCapStyle:
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_line_endcap(props[i]->op);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1410,7 +1422,7 @@ void XlsConverter::convert_blip(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
if (props.size() < 1) return;
|
||||
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
ODRAW::FixedPoint * fixed_point = static_cast<ODRAW::FixedPoint *>(props[i].get());
|
||||
switch(props[i]->opid)
|
||||
@ -1457,7 +1469,7 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
|
||||
oox::_rect rect;
|
||||
std::vector<_CP_OPT(int)> adjustValues(8);
|
||||
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1489,6 +1501,24 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
|
||||
adjustValues[props[i]->opid - 0x0147] = props[i]->op ;
|
||||
}break;
|
||||
case 0x0151:
|
||||
{
|
||||
ODRAW::pConnectionSites * a = (ODRAW::pConnectionSites *)(props[i].get());
|
||||
xlsx_context->get_drawing_context().set_custom_connection(a->complex.data);
|
||||
}break;
|
||||
case 0x0152:
|
||||
{
|
||||
ODRAW::pConnectionSitesDir * a = (ODRAW::pConnectionSitesDir *)(props[i].get());
|
||||
xlsx_context->get_drawing_context().set_custom_connectionDir(a->complex.data);
|
||||
}break;
|
||||
case 0x0153:
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_custom_x_limo(props[i]->op);
|
||||
}break;
|
||||
case 0x0154:
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_custom_y_limo(props[i]->op);
|
||||
}break;
|
||||
case 0x0155:
|
||||
{
|
||||
ODRAW::pAdjustHandles * a = (ODRAW::pAdjustHandles *)(props[i].get());
|
||||
xlsx_context->get_drawing_context().set_custom_adjustHandles(a->complex.data);
|
||||
@ -1498,6 +1528,16 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
|
||||
ODRAW::pGuides* s = (ODRAW::pGuides *)(props[i].get());
|
||||
xlsx_context->get_drawing_context().set_custom_guides(s->complex.data);
|
||||
}break;
|
||||
case 0x0157:
|
||||
{
|
||||
ODRAW::pInscribe * a = (ODRAW::pInscribe *)(props[i].get());
|
||||
xlsx_context->get_drawing_context().set_custom_inscribe(a->complex.data);
|
||||
}break;
|
||||
//case 0x0158:
|
||||
// {
|
||||
// ODRAW::cxk * a = (ODRAW::cxk *)(props[i].get());
|
||||
// xlsx_context->get_drawing_context().set_custom_cxk(a->complex.data);
|
||||
// }break;
|
||||
}
|
||||
}
|
||||
rect.cy -= rect.y;
|
||||
@ -1510,7 +1550,7 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
|
||||
{
|
||||
if (props.size() < 1) return;
|
||||
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1571,7 +1611,7 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
if (props.size() < 1) return;
|
||||
|
||||
RECT text_margin = {0x00016530, 0x0000b298, 0x00016530, 0x0000b298};
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1647,20 +1687,20 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
}
|
||||
void XlsConverter::convert_shadow(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
}
|
||||
}
|
||||
void XlsConverter::convert_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
void XlsConverter::convert_group_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1726,7 +1766,7 @@ void XlsConverter::convert(XLS::Note* note)
|
||||
|
||||
void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
|
||||
{
|
||||
for (int i = 0 ; i < props.size() ; i++)
|
||||
for (size_t i = 0 ; i < props.size() ; i++)
|
||||
{
|
||||
switch(props[i]->opid)
|
||||
{
|
||||
@ -1774,7 +1814,7 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
|
||||
for (size_t i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"si")
|
||||
{
|
||||
|
||||
@ -622,7 +622,7 @@ void xlsx_drawing_context::serialize_group()
|
||||
//serialize_line(CP_XML_STREAM(), drawing_state);
|
||||
}
|
||||
|
||||
for (int i = 1; i < current_drawing_states->size(); i++)
|
||||
for (size_t i = 1; i < current_drawing_states->size(); i++)
|
||||
{
|
||||
CP_XML_STREAM() << current_drawing_states->at(i)->shape;
|
||||
//todooo current_drawing_states->at(i).shape.erase(); // память поэкономить
|
||||
@ -1033,7 +1033,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
|
||||
|
||||
shape->m_oCustomVML.m_bIsVerticesPresent = drawing_state->custom_verticles.empty() ? false : true;
|
||||
|
||||
for (int i = 0 ; i < drawing_state->custom_verticles.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_state->custom_verticles.size(); i++)
|
||||
{
|
||||
Aggplus::POINT p;
|
||||
|
||||
@ -1043,7 +1043,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
|
||||
shape->m_oCustomVML.m_arVertices.push_back(p);
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < drawing_state->custom_guides.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_state->custom_guides.size(); i++)
|
||||
{//todooo объеденить/срастить !!
|
||||
NSCustomShapesConvert::CGuide guid;
|
||||
|
||||
@ -1058,7 +1058,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
|
||||
shape->m_oCustomVML.addGuide(guid);
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < drawing_state->custom_segments.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_state->custom_segments.size(); i++)
|
||||
{
|
||||
if (0 == drawing_state->custom_segments[i].m_nCount)
|
||||
{
|
||||
@ -1076,7 +1076,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
|
||||
//{//todooo - ранее этого не было ?????
|
||||
// shape->m_oCustomVML.addHandle(i, *drawing_state->custom_adjustHandles[i]);
|
||||
//}
|
||||
for (int i = 0; i < drawing_state->custom_adjustValues.size(); i++)
|
||||
for (size_t i = 0; i < drawing_state->custom_adjustValues.size(); i++)
|
||||
{
|
||||
if (drawing_state->custom_adjustValues[i])
|
||||
{
|
||||
@ -1301,7 +1301,7 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
|
||||
|
||||
if ( !fill.colorsPosition.empty() )
|
||||
{
|
||||
for (int i = 0; i < fill.colorsPosition.size(); i++)
|
||||
for (size_t i = 0; i < fill.colorsPosition.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"a:gs")
|
||||
{
|
||||
@ -1600,6 +1600,13 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
|
||||
else
|
||||
CP_XML_ATTR(L"w", 9525); //default
|
||||
|
||||
switch(line.endcap)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"cap", L"rnd"); break;
|
||||
case 1: CP_XML_ATTR(L"cap", L"sq"); break;
|
||||
case 2: CP_XML_ATTR(L"cap", L"flat"); break;
|
||||
}
|
||||
|
||||
serialize_fill(CP_XML_STREAM(), line.fill);
|
||||
|
||||
CP_XML_NODE(L"a:prstDash")
|
||||
@ -1613,6 +1620,18 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
|
||||
case lineDashDotDot:CP_XML_ATTR(L"val", L"lgDashDotDot"); break;
|
||||
}
|
||||
}
|
||||
switch(line.join)
|
||||
{
|
||||
case 0: CP_XML_NODE(L"a:bevel"); break;
|
||||
case 1:
|
||||
CP_XML_NODE(L"a:miter")
|
||||
{
|
||||
if (line.miter > 0)
|
||||
CP_XML_ATTR(L"lim", line.miter * 1000);
|
||||
}break;
|
||||
case 2: CP_XML_NODE(L"a:round"); break;
|
||||
}
|
||||
|
||||
if (line.arrow.enabled)
|
||||
{
|
||||
serialize_arrow(CP_XML_STREAM(), L"a:headEnd", line.arrow.start, line.arrow.start_width, line.arrow.start_length);
|
||||
@ -2019,7 +2038,27 @@ void xlsx_drawing_context::set_line_width (int val)
|
||||
|
||||
current_drawing_states->back()->line.width = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_line_miter(int val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->line.miter = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_line_join(int val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->line.join = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_line_endcap(int val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->line.endcap = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_line_arrow(bool val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
@ -2032,7 +2071,8 @@ void xlsx_drawing_context::set_arrow_start (int val)
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->line.arrow.start = val;
|
||||
current_drawing_states->back()->line.arrow.start = val;
|
||||
current_drawing_states->back()->line.arrow.enabled = true;
|
||||
}
|
||||
void xlsx_drawing_context::set_arrow_end (int val)
|
||||
{
|
||||
@ -2040,6 +2080,7 @@ void xlsx_drawing_context::set_arrow_end (int val)
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->line.arrow.end = val;
|
||||
current_drawing_states->back()->line.arrow.enabled = true;
|
||||
}
|
||||
void xlsx_drawing_context::set_arrow_start_width (int val)
|
||||
{
|
||||
@ -2375,6 +2416,41 @@ void xlsx_drawing_context::set_custom_path (int type_path)
|
||||
|
||||
current_drawing_states->back()->custom_path = type_path;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& points)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->custom_connection = points;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->custom_connectionDir = points;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_inscribe(std::vector<ODRAW::MSORECT>& rects)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->custom_inscribe = rects;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_x_limo(int val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->custom_x_limo = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_y_limo(int val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
current_drawing_states->back()->custom_y_limo = val;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
bool xlsx_drawing_context::get_mode_vmlwrite ()
|
||||
{//comment, shapes in header/footer, ....
|
||||
@ -2435,7 +2511,7 @@ void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
|
||||
CP_XML_ATTR(L"xmlns:o" , L"urn:schemas-microsoft-com:office:office");
|
||||
CP_XML_ATTR(L"xmlns:x" , L"urn:schemas-microsoft-com:office:excel");
|
||||
|
||||
for (int i = 0 ; i < drawing_states_vml_HF.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_states_vml_HF.size(); i++)
|
||||
{
|
||||
serialize_vml(CP_XML_STREAM(), drawing_states_vml_HF[i]);
|
||||
}
|
||||
@ -2471,7 +2547,7 @@ void xlsx_drawing_context::serialize_vml_comments(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < drawing_states_vml_comments.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_states_vml_comments.size(); i++)
|
||||
{
|
||||
serialize_vml(CP_XML_STREAM(), drawing_states_vml_comments[i]);
|
||||
}
|
||||
@ -2490,7 +2566,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:mc" , L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
for (int i = 0 ; i < drawing_states.size(); i++)
|
||||
for (size_t i = 0 ; i < drawing_states.size(); i++)
|
||||
{
|
||||
serialize(CP_XML_STREAM(), drawing_states[i]);
|
||||
}
|
||||
|
||||
@ -137,10 +137,12 @@ public:
|
||||
type_anchor(0),
|
||||
vmlwrite_mode_(false)
|
||||
{
|
||||
id = -1;
|
||||
rotation = 0;
|
||||
parent_drawing_states = NULL;
|
||||
custom_path = -1;
|
||||
id = -1;
|
||||
rotation = 0;
|
||||
parent_drawing_states = NULL;
|
||||
custom_path = -1;
|
||||
custom_x_limo = 0x80000000;
|
||||
custom_y_limo = 0x80000000;
|
||||
}
|
||||
|
||||
external_items::Type type;
|
||||
@ -179,10 +181,15 @@ public:
|
||||
std::vector<ODRAW::MSOSG> custom_guides;
|
||||
std::vector<ODRAW::MSOPOINT> custom_verticles;
|
||||
std::vector<ODRAW::ADJH> custom_adjustHandles;
|
||||
std::vector<ODRAW::MSOPOINT> custom_connection;
|
||||
std::vector<ODRAW::FixedPoint> custom_connectionDir;
|
||||
std::vector<ODRAW::MSORECT> custom_inscribe;
|
||||
|
||||
_rect custom_rect;
|
||||
std::vector<_CP_OPT(int)> custom_adjustValues;
|
||||
int custom_path;
|
||||
int custom_x_limo;
|
||||
int custom_y_limo;
|
||||
//-----------------------------------------------
|
||||
std::wstring hyperlink;
|
||||
struct _text
|
||||
@ -265,12 +272,15 @@ public:
|
||||
};
|
||||
struct _line
|
||||
{
|
||||
_line() { fill.color.SetRGB(0, 0, 0); width = 0; }
|
||||
_line() : join(-1), endcap(-1), miter(0), width(0) { fill.color.SetRGB(0, 0, 0); }
|
||||
std::wstring style;
|
||||
int width;
|
||||
_line_typeDash typeDash;
|
||||
_fill fill;
|
||||
_arrow arrow;
|
||||
int miter;
|
||||
int join;
|
||||
int endcap;
|
||||
}line;
|
||||
struct _object
|
||||
{
|
||||
@ -357,6 +367,9 @@ public:
|
||||
void set_arrow_end_width (int val);
|
||||
void set_arrow_start_length (int val);
|
||||
void set_arrow_end_length (int val);
|
||||
void set_line_miter (int val);
|
||||
void set_line_join (int val);
|
||||
void set_line_endcap (int val);
|
||||
|
||||
void set_fill_old_version (_UINT32 val);
|
||||
void set_line_old_version (_UINT32 val);
|
||||
@ -399,6 +412,11 @@ public:
|
||||
void set_custom_adjustHandles(std::vector<ODRAW::ADJH> & handles);
|
||||
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
|
||||
void set_custom_path (int type_path);
|
||||
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
|
||||
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points);
|
||||
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
|
||||
void set_custom_x_limo (int val);
|
||||
void set_custom_y_limo (int val);
|
||||
//------------------------------------------------------------------------------
|
||||
void serialize_group ();
|
||||
void serialize_shape (_drawing_state_ptr & drawing_state);
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
SET PLATFORM=win
|
||||
SET ARCH=_32
|
||||
|
||||
SET PLATFORM=win_32
|
||||
if defined ProgramFiles(x86) (
|
||||
SET ARCH=_64
|
||||
SET PLATFORM=win_64
|
||||
)
|
||||
|
||||
mkdir "%SCRIPTPATH%%PLATFORM%%ARCH%"
|
||||
cd "%SCRIPTPATH%%PLATFORM%%ARCH%"
|
||||
if defined TARGET (
|
||||
SET PLATFORM=%TARGET%
|
||||
)
|
||||
|
||||
mkdir "%SCRIPTPATH%%PLATFORM%"
|
||||
cd "%SCRIPTPATH%%PLATFORM%"
|
||||
|
||||
if exist "cef_binary.7z" (
|
||||
echo "cef_binary.7z already downloaded"
|
||||
) else (
|
||||
Powershell.exe Invoke-WebRequest -OutFile cef_binary.7z http://d2ettrnqo7v976.cloudfront.net/cef/2454/%PLATFORM%%ARCH%/cef_binary.7z
|
||||
Powershell.exe Invoke-WebRequest -OutFile cef_binary.7z http://d2ettrnqo7v976.cloudfront.net/cef/2454/%PLATFORM%/cef_binary.7z
|
||||
)
|
||||
|
||||
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
|
||||
|
||||
@ -6,6 +6,10 @@ if defined ProgramFiles(x86) (
|
||||
SET platform=win_64
|
||||
)
|
||||
|
||||
if defined TARGET (
|
||||
SET platform=%TARGET%
|
||||
)
|
||||
|
||||
if not exist "%platform%" (
|
||||
md "%platform%"
|
||||
)
|
||||
|
||||
@ -158,7 +158,16 @@ namespace OOX
|
||||
else if ( pRelation->Type() == FileTypes::Document)
|
||||
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Theme)
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
{
|
||||
if(NSFile::CFileBinary::Exists(oFileName.GetPath()))
|
||||
{
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
}
|
||||
else
|
||||
{
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile() );
|
||||
}
|
||||
}
|
||||
else if ( pRelation->Type() == FileTypes::ThemeOverride)
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Setting)
|
||||
|
||||
@ -1092,6 +1092,13 @@ namespace OOX
|
||||
et_x_SheetPr,
|
||||
et_x_Pane,
|
||||
et_x_ExternalBook,
|
||||
et_x_ExternalSheetNames,
|
||||
et_x_ExternalDefinedNames,
|
||||
et_x_ExternalDefinedName,
|
||||
et_x_ExternalSheetDataSet,
|
||||
et_x_ExternalSheetData,
|
||||
et_x_ExternalRow,
|
||||
et_x_ExternalCell,
|
||||
et_x_Selection,
|
||||
et_x_LegacyDrawingWorksheet,
|
||||
et_x_LegacyDrawingHFWorksheet,
|
||||
|
||||
@ -369,6 +369,71 @@ namespace XmlUtils
|
||||
|
||||
return buffer;
|
||||
}
|
||||
AVSINLINE static std::wstring EncodeXmlStringExtend(const std::wstring& data, bool bDeleteNoUnicode = false)
|
||||
{
|
||||
std::wstring buffer;
|
||||
buffer.reserve(data.size());
|
||||
|
||||
if(bDeleteNoUnicode)
|
||||
{
|
||||
for(size_t pos = 0; pos < data.size(); ++pos)
|
||||
{
|
||||
switch(data[pos])
|
||||
{
|
||||
case '&': buffer.append(L"&"); break;
|
||||
case '\"': buffer.append(L"""); break;
|
||||
case '\'': buffer.append(L"'"); break;
|
||||
case '<': buffer.append(L"<"); break;
|
||||
case '>': buffer.append(L">"); break;
|
||||
case '\n': buffer.append(L"
"); break;
|
||||
case '\r': buffer.append(L"
"); break;
|
||||
case '\t': buffer.append(L"	"); break;
|
||||
case 160: buffer.append(L" "); break;
|
||||
default:
|
||||
{
|
||||
if ( false == IsUnicodeSymbol( data[pos] ) )
|
||||
{
|
||||
wchar_t symbol1 = data[pos];
|
||||
if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size())
|
||||
{
|
||||
pos++;
|
||||
wchar_t symbol2 = data[pos];
|
||||
if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF)
|
||||
{
|
||||
buffer.append(&data[pos-1], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
buffer.append(&data[pos], 1);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(size_t pos = 0; pos < data.size(); ++pos)
|
||||
{
|
||||
switch(data[pos])
|
||||
{
|
||||
case '&': buffer.append(L"&"); break;
|
||||
case '\"': buffer.append(L"""); break;
|
||||
case '\'': buffer.append(L"'"); break;
|
||||
case '<': buffer.append(L"<"); break;
|
||||
case '>': buffer.append(L">"); break;
|
||||
case '\n': buffer.append(L"
"); break;
|
||||
case '\r': buffer.append(L"
"); break;
|
||||
case '\t': buffer.append(L"	"); break;
|
||||
case 160: buffer.append(L" "); break;
|
||||
case '\0':
|
||||
return buffer;
|
||||
default: buffer.append(&data[pos], 1); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
//#ifndef _USE_LIBXML2_READER_
|
||||
class CStringWriter
|
||||
{
|
||||
|
||||
@ -39,6 +39,427 @@ namespace OOX
|
||||
{
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class CExternalSheetNames : public WritingElementWithChilds<ComplexTypes::Spreadsheet::String>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalSheetNames)
|
||||
CExternalSheetNames()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalSheetNames()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"sheetName" == sName)
|
||||
{
|
||||
m_arrItems.push_back(new ComplexTypes::Spreadsheet::String(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<sheetNames>");
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
writer.WriteString(L"<sheetName ");
|
||||
writer.WriteEncodeXmlString(m_arrItems[i]->ToString());
|
||||
writer.WriteString(L"/>");
|
||||
}
|
||||
writer.WriteString(L"</sheetNames>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalSheetNames;
|
||||
}
|
||||
};
|
||||
|
||||
class CExternalDefinedName : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalDefinedName)
|
||||
CExternalDefinedName()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalDefinedName()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( !oReader.IsEmptyNode() )
|
||||
oReader.ReadTillEnd();
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<definedName");
|
||||
WritingStringNullableAttrEncodeXmlString(L"name", m_oName, m_oName.get());
|
||||
WritingStringNullableAttrEncodeXmlString(L"refersTo", m_oRefersTo, m_oRefersTo.get());
|
||||
WritingStringNullableAttrInt(L"sheetId", m_oSheetId, m_oSheetId->GetValue());
|
||||
writer.WriteString(L"/>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalDefinedName;
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if( oReader, _T("name"), m_oName )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("refersTo"), m_oRefersTo )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sheetId"), m_oSheetId )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<std::wstring> m_oName;
|
||||
nullable<std::wstring> m_oRefersTo;
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSheetId;
|
||||
};
|
||||
|
||||
class CExternalDefinedNames : public WritingElementWithChilds<CExternalDefinedName>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalDefinedNames)
|
||||
CExternalDefinedNames()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalDefinedNames()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"definedName" == sName)
|
||||
{
|
||||
m_arrItems.push_back(new CExternalDefinedName(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<definedNames>");
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</definedNames>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalDefinedNames;
|
||||
}
|
||||
};
|
||||
|
||||
class CExternalCell : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalCell)
|
||||
CExternalCell()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalCell()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"v" == sName)
|
||||
{
|
||||
m_oValue = oReader;
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<cell");
|
||||
WritingStringNullableAttrString(L"r", m_oRef, m_oRef.get());
|
||||
WritingStringNullableAttrString(L"t", m_oType, m_oType->ToString());
|
||||
WritingStringNullableAttrInt(L"vm", m_oValueMetadata, m_oValueMetadata->GetValue());
|
||||
writer.WriteString(L">");
|
||||
if(m_oValue.IsInit())
|
||||
m_oValue->toXML2(writer, _T("v"));
|
||||
writer.WriteString(L"</cell>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalCell;
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if( oReader, _T("r"), m_oRef )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("t"), m_oType )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("vm"), m_oValueMetadata )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<std::wstring> m_oRef;
|
||||
nullable<SimpleTypes::Spreadsheet::CCellTypeType<>> m_oType;
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oValueMetadata;
|
||||
|
||||
nullable<CText> m_oValue;
|
||||
};
|
||||
|
||||
class CExternalRow : public WritingElementWithChilds<CExternalCell>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalRow)
|
||||
CExternalRow()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalRow()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"cell" == sName)
|
||||
{
|
||||
m_arrItems.push_back(new CExternalCell(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<row");
|
||||
WritingStringNullableAttrInt(L"r", m_oR, m_oR->GetValue());
|
||||
writer.WriteString(L">");
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</row>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalRow;
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r"), m_oR )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oR;
|
||||
};
|
||||
|
||||
class CExternalSheetData : public WritingElementWithChilds<CExternalRow>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalSheetData)
|
||||
CExternalSheetData()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalSheetData()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"row" == sName)
|
||||
{
|
||||
m_arrItems.push_back(new CExternalRow(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<sheetData");
|
||||
WritingStringNullableAttrInt(L"sheetId", m_oSheetId, m_oSheetId->GetValue());
|
||||
WritingStringNullableAttrBool(L"refreshError", m_oRefreshError);
|
||||
writer.WriteString(L">");
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</sheetData>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalSheetData;
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if( oReader, _T("sheetId"), m_oSheetId )
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("refreshError"), m_oRefreshError )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSheetId;
|
||||
nullable<SimpleTypes::COnOff<SimpleTypes::onoffTrue>> m_oRefreshError;
|
||||
};
|
||||
|
||||
class CExternalSheetDataSet : public WritingElementWithChilds<CExternalSheetData>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CExternalSheetDataSet)
|
||||
CExternalSheetDataSet()
|
||||
{
|
||||
}
|
||||
virtual ~CExternalSheetDataSet()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& oNode)
|
||||
{
|
||||
// TO DO: Реализовать
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if (L"sheetData" == sName)
|
||||
{
|
||||
m_arrItems.push_back(new CExternalSheetData(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<sheetDataSet>");
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</sheetDataSet>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
NSStringUtils::CStringBuilder writer;
|
||||
toXML(writer);
|
||||
return writer.GetData().c_str();
|
||||
}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_ExternalSheetDataSet;
|
||||
}
|
||||
};
|
||||
|
||||
class CExternalBook : public WritingElement
|
||||
{
|
||||
public:
|
||||
@ -67,6 +488,19 @@ namespace OOX
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
|
||||
if (L"sheetNames" == sName)
|
||||
{
|
||||
m_oSheetNames = oReader;
|
||||
}
|
||||
else if (L"definedNames" == sName)
|
||||
{
|
||||
m_oDefinedNames = oReader;
|
||||
}
|
||||
else if (L"sheetDataSet" == sName)
|
||||
{
|
||||
m_oSheetDataSet = oReader;
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
@ -78,7 +512,20 @@ namespace OOX
|
||||
writer.WriteString(m_oRid->ToString());
|
||||
writer.WriteString(L"\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"");
|
||||
}
|
||||
writer.WriteString(L"/>");
|
||||
writer.WriteString(L">");
|
||||
if (m_oSheetNames.IsInit())
|
||||
{
|
||||
m_oSheetNames->toXML(writer);
|
||||
}
|
||||
if (m_oDefinedNames.IsInit())
|
||||
{
|
||||
m_oDefinedNames->toXML(writer);
|
||||
}
|
||||
if (m_oSheetDataSet.IsInit())
|
||||
{
|
||||
m_oSheetDataSet->toXML(writer);
|
||||
}
|
||||
writer.WriteString(L"</externalBook>");
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
@ -99,6 +546,10 @@ namespace OOX
|
||||
public:
|
||||
|
||||
nullable<SimpleTypes::CRelationshipId > m_oRid;
|
||||
|
||||
nullable<CExternalSheetNames > m_oSheetNames;
|
||||
nullable<CExternalDefinedNames > m_oDefinedNames;
|
||||
nullable<CExternalSheetDataSet > m_oSheetDataSet;
|
||||
};
|
||||
|
||||
class CExternalLink : public OOX::FileGlobalEnumerated, public OOX::IFileContainer
|
||||
@ -106,9 +557,11 @@ namespace OOX
|
||||
public:
|
||||
CExternalLink()
|
||||
{
|
||||
m_bSpreadsheets = true;
|
||||
}
|
||||
CExternalLink(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_bSpreadsheets = true;
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
virtual ~CExternalLink()
|
||||
|
||||
@ -128,7 +128,16 @@ namespace OOX
|
||||
else if ( pRelation->Type() == FileTypes::Worksheet )
|
||||
return smart_ptr<OOX::File>(new CWorksheet( oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::Theme )
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
{
|
||||
if(NSFile::CFileBinary::Exists(oFileName.GetPath()))
|
||||
{
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
}
|
||||
else
|
||||
{
|
||||
return smart_ptr<OOX::File>( new UnknowTypeFile() );
|
||||
}
|
||||
}
|
||||
else if ( pRelation->Type() == OOX::FileTypes::ThemeOverride )
|
||||
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Drawings )
|
||||
|
||||
@ -644,7 +644,12 @@ namespace MetaFile
|
||||
dKoefG = 255.0 / (ulMaskG >> ulShiftG);
|
||||
dKoefB = 255.0 / (ulMaskB >> ulShiftB);
|
||||
|
||||
bMask = true;
|
||||
if ((ulMaskR >> ulShiftR) == 255 && (ulMaskG >> ulShiftG) == 255 && (ulMaskB >> ulShiftB) == 255)
|
||||
{
|
||||
bMask = false; // Proper_Attire_CALT2.odt
|
||||
}
|
||||
else
|
||||
bMask = true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
@ -35,8 +35,142 @@
|
||||
#include "../../../common/String.h"
|
||||
#include "../../../fontengine/FontManager.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
static const struct ActionNamesEmf
|
||||
{
|
||||
int actionNumber;
|
||||
std::wstring actionName;
|
||||
} actionNamesEmf[] =
|
||||
{
|
||||
{ 0, L"Unknown"},
|
||||
{ EMR_HEADER, L"EMR_HEADER"},
|
||||
{ EMR_POLYBEZIER, L"EMR_POLYBEZIER"},
|
||||
{ EMR_POLYGON, L"EMR_POLYGON"},
|
||||
{ EMR_POLYLINE, L"EMR_POLYLINE"},
|
||||
{ EMR_POLYBEZIERTO, L"EMR_POLYBEZIERTO"},
|
||||
{ EMR_POLYLINETO, L"EMR_POLYLINETO"},
|
||||
{ EMR_POLYPOLYLINE, L"EMR_POLYPOLYLINE"},
|
||||
{ EMR_POLYPOLYGON, L"EMR_POLYPOLYGON"},
|
||||
{ EMR_SETWINDOWEXTEX, L"EMR_SETWINDOWEXTEX"},
|
||||
{ EMR_SETWINDOWORGEX, L"EMR_SETWINDOWORGEX"},
|
||||
{ EMR_SETVIEWPORTEXTEX, L"EMR_SETVIEWPORTEXTEX"},
|
||||
{ EMR_SETVIEWPORTORGEX, L"EMR_SETVIEWPORTORGEX"},
|
||||
{ EMR_SETBRUSHORGEX, L"EMR_SETBRUSHORGEX"},
|
||||
{ EMR_EOF, L"EMR_EOF"},
|
||||
{ EMR_SETPIXELV, L"EMR_SETPIXELV"},
|
||||
{ EMR_SETMAPPERFLAGS, L"EMR_SETMAPPERFLAGS"},
|
||||
{ EMR_SETMAPMODE, L"EMR_SETMAPMODE"},
|
||||
{ EMR_SETBKMODE, L"EMR_SETBKMODE"},
|
||||
{ EMR_SETPOLYFILLMODE, L"EMR_SETPOLYFILLMODE"},
|
||||
{ EMR_SETROP2, L"EMR_SETROP2"},
|
||||
{ EMR_SETSTRETCHBLTMODE, L"EMR_SETSTRETCHBLTMODE"},
|
||||
{ EMR_SETTEXTALIGN, L"EMR_SETTEXTALIGN"},
|
||||
{ EMR_SETCOLORADJUSTMENT, L"EMR_SETCOLORADJUSTMENT"},
|
||||
{ EMR_SETTEXTCOLOR, L"EMR_SETTEXTCOLOR"},
|
||||
{ EMR_SETBKCOLOR, L"EMR_SETBKCOLOR"},
|
||||
{ EMR_OFFSETCLIPRGN, L"EMR_OFFSETCLIPRGN"},
|
||||
{ EMR_MOVETOEX, L"EMR_MOVETOEX"},
|
||||
{ EMR_SETMETARGN, L"EMR_SETMETARGN"},
|
||||
{ EMR_EXCLUDECLIPRECT, L"EMR_EXCLUDECLIPRECT"},
|
||||
{ EMR_INTERSECTCLIPRECT, L"EMR_INTERSECTCLIPRECT"},
|
||||
{ EMR_SCALEVIEWPORTEXTEX, L"EMR_SCALEVIEWPORTEXTEX"},
|
||||
{ EMR_SCALEWINDOWEXTEX, L"EMR_SCALEWINDOWEXTEX"},
|
||||
{ EMR_SAVEDC, L"EMR_SAVEDC"},
|
||||
{ EMR_RESTOREDC, L"EMR_RESTOREDC"},
|
||||
{ EMR_SETWORLDTRANSFORM, L"EMR_SETWORLDTRANSFORM"},
|
||||
{ EMR_MODIFYWORLDTRANSFORM, L"EMR_MODIFYWORLDTRANSFORM"},
|
||||
{ EMR_SELECTOBJECT, L"EMR_SELECTOBJECT"},
|
||||
{ EMR_CREATEPEN, L"EMR_CREATEPEN"},
|
||||
{ EMR_CREATEBRUSHINDIRECT, L"EMR_CREATEBRUSHINDIRECT"},
|
||||
{ EMR_DELETEOBJECT, L"EMR_DELETEOBJECT"},
|
||||
{ EMR_ANGLEARC, L"EMR_ANGLEARC"},
|
||||
{ EMR_ELLIPSE, L"EMR_ELLIPSE"},
|
||||
{ EMR_RECTANGLE, L"EMR_RECTANGLE"},
|
||||
{ EMR_ROUNDRECT, L"EMR_ROUNDRECT"},
|
||||
{ EMR_ARC, L"EMR_ARC"},
|
||||
{ EMR_CHORD, L"EMR_CHORD"},
|
||||
{ EMR_PIE, L"EMR_PIE"},
|
||||
{ EMR_SELECTPALETTE, L"EMR_SELECTPALETTE"},
|
||||
{ EMR_CREATEPALETTE, L"EMR_CREATEPALETTE"},
|
||||
{ EMR_SETPALETTEENTRIES, L"EMR_SETPALETTEENTRIES"},
|
||||
{ EMR_RESIZEPALETTE, L"EMR_RESIZEPALETTE"},
|
||||
{ EMR_REALIZEPALETTE, L"EMR_REALIZEPALETTE"},
|
||||
{ EMR_EXTFLOODFILL, L"EMR_EXTFLOODFILL"},
|
||||
{ EMR_LINETO, L"EMR_LINETO"},
|
||||
{ EMR_ARCTO, L"EMR_ARCTO"},
|
||||
{ EMR_POLYDRAW, L"EMR_POLYDRAW"},
|
||||
{ EMR_SETARCDIRECTION, L"EMR_SETARCDIRECTION"},
|
||||
{ EMR_SETMITERLIMIT, L"EMR_SETMITERLIMIT"},
|
||||
{ EMR_BEGINPATH, L"EMR_BEGINPATH"},
|
||||
{ EMR_ENDPATH, L"EMR_ENDPATH"},
|
||||
{ EMR_CLOSEFIGURE, L"EMR_CLOSEFIGURE"},
|
||||
{ EMR_FILLPATH, L"EMR_FILLPATH"},
|
||||
{ EMR_STROKEANDFILLPATH, L"EMR_STROKEANDFILLPATH"},
|
||||
{ EMR_STROKEPATH, L"EMR_STROKEPATH"},
|
||||
{ EMR_FLATTENPATH, L"EMR_FLATTENPATH"},
|
||||
{ EMR_WIDENPATH, L"EMR_WIDENPATH"},
|
||||
{ EMR_SELECTCLIPPATH, L"EMR_SELECTCLIPPATH"},
|
||||
{ EMR_ABORTPATH, L"EMR_ABORTPATH"},
|
||||
{ 69, L"Unknown"},
|
||||
{ EMR_GDICOMMENT, L"EMR_GDICOMMENT"},
|
||||
{ EMR_FILLRGN, L"EMR_FILLRGN"},
|
||||
{ EMR_FRAMERGN, L"EMR_FRAMERGN"},
|
||||
{ EMR_INVERTRGN, L"EMR_INVERTRGN"},
|
||||
{ EMR_PAINTRGN, L"EMR_PAINTRGN"},
|
||||
{ EMR_EXTSELECTCLIPRGN, L"EMR_EXTSELECTCLIPRGN"},
|
||||
{ EMR_BITBLT, L"EMR_BITBLT"},
|
||||
{ EMR_STRETCHBLT, L"EMR_STRETCHBLT"},
|
||||
{ EMR_MASKBLT, L"EMR_MASKBLT"},
|
||||
{ EMR_PLGBLT, L"EMR_PLGBLT"},
|
||||
{ EMR_SETDIBITSTODEVICE, L"EMR_SETDIBITSTODEVICE"},
|
||||
{ EMR_STRETCHDIBITS, L"EMR_STRETCHDIBITS"},
|
||||
{ EMR_EXTCREATEFONTINDIRECTW, L"EMR_EXTCREATEFONTINDIRECTW"},
|
||||
{ EMR_EXTTEXTOUTA, L"EMR_EXTTEXTOUTA"},
|
||||
{ EMR_EXTTEXTOUTW, L"EMR_EXTTEXTOUTW"},
|
||||
{ EMR_POLYBEZIER16, L"EMR_POLYBEZIER16"},
|
||||
{ EMR_POLYGON16, L"EMR_POLYGON16"},
|
||||
{ EMR_POLYLINE16, L"EMR_POLYLINE16"},
|
||||
{ EMR_POLYBEZIERTO16, L"EMR_POLYBEZIERTO16"},
|
||||
{ EMR_POLYLINETO16, L"EMR_POLYLINETO16"},
|
||||
{ EMR_POLYPOLYLINE16, L"EMR_POLYPOLYLINE16"},
|
||||
{ EMR_POLYPOLYGON16, L"EMR_POLYPOLYGON16"},
|
||||
{ EMR_POLYDRAW16, L"EMR_POLYDRAW16"},
|
||||
{ EMR_CREATEMONOBRUSH, L"EMR_CREATEMONOBRUSH"},
|
||||
{ EMR_CREATEDIBPATTERNBRUSHPT,L"EMR_CREATEDIBPATTERNBRUSHPT"},
|
||||
{ EMR_EXTCREATEPEN, L"EMR_EXTCREATEPEN"},
|
||||
{ EMR_POLYTEXTOUTA, L"EMR_POLYTEXTOUTA"},
|
||||
{ EMR_POLYTEXTOUTW, L"EMR_POLYTEXTOUTW"},
|
||||
{ EMR_SETICMMODE, L"EMR_SETICMMODE"},
|
||||
{ EMR_CREATECOLORSPACE, L"EMR_CREATECOLORSPACE"},
|
||||
{ EMR_SETCOLORSPACE, L"EMR_SETCOLORSPACE"},
|
||||
{ EMR_DELETECOLORSPACE, L"EMR_DELETECOLORSPACE"},
|
||||
{ EMR_GLSRECORD, L"EMR_GLSRECORD"},
|
||||
{ EMR_GLSBOUNDEDRECORD, L"EMR_GLSBOUNDEDRECORD"},
|
||||
{ EMR_PIXELFORMAT, L"EMR_PIXELFORMAT"},
|
||||
{ EMR_RESERVED_105, L"EMR_RESERVED_105"},
|
||||
{ EMR_RESERVED_106, L"EMR_RESERVED_106"},
|
||||
{ EMR_RESERVED_107, L"EMR_RESERVED_107"},
|
||||
{ EMR_RESERVED_108, L"EMR_RESERVED_108"},
|
||||
{ EMR_RESERVED_109, L"EMR_RESERVED_109"},
|
||||
{ EMR_RESERVED_110, L"EMR_RESERVED_110"},
|
||||
{ EMR_COLORCORRECTPALETTE, L"EMR_COLORCORRECTPALETTE"},
|
||||
{ EMR_SETICMPROFILEA, L"EMR_SETICMPROFILEA"},
|
||||
{ EMR_SETICMPROFILEW, L"EMR_SETICMPROFILEW"},
|
||||
{ EMR_ALPHABLEND, L"EMR_ALPHABLEND"},
|
||||
{ EMR_SETLAYOUT, L"EMR_SETLAYOUT"},
|
||||
{ EMR_TRANSPARENTBLT, L"EMR_TRANSPARENTBLT"},
|
||||
{ EMR_RESERVED_117, L"EMR_RESERVED_117"},
|
||||
{ EMR_GRADIENTFILL, L"EMR_GRADIENTFILL"},
|
||||
{ EMR_RESERVED_119, L"EMR_RESERVED_119"},
|
||||
{ EMR_RESERVED_120, L"EMR_RESERVED_120"},
|
||||
{ EMR_COLORMATCHTOTARGETW, L"EMR_COLORMATCHTOTARGETW"},
|
||||
{ EMR_CREATECOLORSPACEW, L"EMR_CREATECOLORSPACEW "}
|
||||
};
|
||||
void CEmfFile::PlayMetaFile()
|
||||
{
|
||||
if (!m_oStream.IsValid())
|
||||
@ -47,7 +181,8 @@ namespace MetaFile
|
||||
|
||||
bool bEof = false;
|
||||
|
||||
unsigned int ulRecordIndex = 0;
|
||||
unsigned int ulRecordIndex = 0;
|
||||
unsigned int m_ulRecordPos = 0;
|
||||
|
||||
if (m_pOutput)
|
||||
m_pOutput->Begin();
|
||||
@ -60,10 +195,17 @@ namespace MetaFile
|
||||
m_oStream >> ulType;
|
||||
m_oStream >> ulSize;
|
||||
|
||||
m_ulRecordSize = ulSize - 8;
|
||||
m_ulRecordPos = m_oStream.Tell();
|
||||
m_ulRecordSize = ulSize - 8;
|
||||
|
||||
if (ulType < EMR_MIN || ulType > EMR_MAX)
|
||||
return SetError();
|
||||
{
|
||||
if (ENHMETA_SIGNATURE != m_oHeader.ulSignature || 0x00010000 != m_oHeader.ulVersion)
|
||||
return SetError();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (0 == ulRecordIndex && EMR_HEADER != ulType)
|
||||
return SetError();
|
||||
@ -95,7 +237,7 @@ namespace MetaFile
|
||||
// 2.3.5 Drawing
|
||||
//-----------------------------------------------------------
|
||||
case EMR_ANGLEARC: Read_EMR_ANGLEARC(); break;
|
||||
case EMR_ARC: Read_EMR_ARC(); break;
|
||||
case EMR_ARC: Read_EMR_ARC(); break;
|
||||
case EMR_ARCTO: Read_EMR_ARCTO(); break;
|
||||
case EMR_CHORD: Read_EMR_CHORD(); break;
|
||||
case EMR_ELLIPSE: Read_EMR_ELLIPSE(); break;
|
||||
@ -103,7 +245,7 @@ namespace MetaFile
|
||||
case EMR_EXTTEXTOUTW: Read_EMR_EXTTEXTOUTW(); break;
|
||||
case EMR_FILLPATH: Read_EMR_FILLPATH(); break;
|
||||
case EMR_LINETO: Read_EMR_LINETO(); break;
|
||||
case EMR_PIE: Read_EMR_PIE(); break;
|
||||
case EMR_PIE: Read_EMR_PIE(); break;
|
||||
case EMR_POLYBEZIER: Read_EMR_POLYBEZIER(); break;
|
||||
case EMR_POLYBEZIER16: Read_EMR_POLYBEZIER16(); break;
|
||||
case EMR_POLYBEZIERTO: Read_EMR_POLYBEZIERTO(); break;
|
||||
@ -134,7 +276,7 @@ namespace MetaFile
|
||||
case EMR_CREATEBRUSHINDIRECT: Read_EMR_CREATEBRUSHINDIRECT(); break;
|
||||
case EMR_CREATEDIBPATTERNBRUSHPT: Read_EMR_CREATEDIBPATTERNBRUSHPT(); break;
|
||||
case EMR_CREATEPALETTE: Read_EMR_CREATEPALETTE(); break;
|
||||
case EMR_CREATEPEN: Read_EMR_CREATEPEN(); break;
|
||||
case EMR_CREATEPEN: Read_EMR_CREATEPEN(); break;
|
||||
case EMR_EXTCREATEFONTINDIRECTW: Read_EMR_EXTCREATEFONTINDIRECTW(); break;
|
||||
case EMR_EXTCREATEPEN: Read_EMR_EXTCREATEPEN(); break;
|
||||
//-----------------------------------------------------------
|
||||
@ -198,6 +340,17 @@ namespace MetaFile
|
||||
if (bEof)
|
||||
break;
|
||||
|
||||
int need_skip = m_ulRecordSize - (m_oStream.Tell() - m_ulRecordPos);
|
||||
m_oStream.Skip(need_skip);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if ( need_skip != 0 && !m_pOutput)
|
||||
{
|
||||
std::wstring name = actionNamesEmf[ulType].actionName;
|
||||
|
||||
std::wcout << name << L"\t\t(" << ulType << L")\t; skiped = " << need_skip << L"\n";
|
||||
}
|
||||
#endif
|
||||
ulRecordIndex++;
|
||||
|
||||
} while (!CheckError());
|
||||
@ -732,9 +885,9 @@ namespace MetaFile
|
||||
{
|
||||
// Делаем цветом кисти
|
||||
pBgraBuffer = new BYTE[4];
|
||||
pBgraBuffer[0] = pBrush->Color.b;
|
||||
pBgraBuffer[0] = pBrush->Color.b;
|
||||
pBgraBuffer[1] = pBrush->Color.g;
|
||||
pBgraBuffer[2] = pBrush->Color.r;
|
||||
pBgraBuffer[2] = pBrush->Color.r;
|
||||
pBgraBuffer[3] = 30;
|
||||
|
||||
ulWidth = 1;
|
||||
@ -1419,6 +1572,8 @@ namespace MetaFile
|
||||
template<typename T>void CEmfFile::Read_EMR_POLYDRAW_BASE()
|
||||
{
|
||||
// TODO: Как найдутся файлы проверить данную запись.
|
||||
//bug #35006 - не прочитывается весь рекорд ... выравнивание?
|
||||
|
||||
TEmfRectL oBounds;
|
||||
m_oStream >> oBounds;
|
||||
|
||||
|
||||
@ -360,6 +360,8 @@ namespace MetaFile
|
||||
|
||||
struct TEmfHeader
|
||||
{
|
||||
TEmfHeader() : ulSignature(0), ulVersion(0), ulRecords(0), ushObjects(0), ulSize(0), ulPalEntries(0), ulOffsetDescription(0),ulSizeDescription(0) {}
|
||||
|
||||
TEmfRectL oBounds;
|
||||
TEmfRectL oFrame;
|
||||
unsigned int ulSignature;
|
||||
|
||||
@ -50,11 +50,11 @@
|
||||
namespace MetaFile
|
||||
{
|
||||
|
||||
static const struct ActionNames
|
||||
static const struct ActionNamesSmv
|
||||
{
|
||||
int actionNumber;
|
||||
std::wstring actionName;
|
||||
} actionNames[] =
|
||||
} actionNamesSmv[] =
|
||||
{
|
||||
{ META_NULL_ACTION, L"META_NULL_ACTION" },
|
||||
{ META_PIXEL_ACTION, L"META_PIXEL_ACTION" },
|
||||
@ -224,7 +224,7 @@ void CSvmFile::PlayMetaFile()
|
||||
#ifdef _DEBUG
|
||||
if (100 <= actionType && actionType <= META_LAST_ACTION && need_skip > 0 && !m_pOutput)
|
||||
{
|
||||
std::wstring name = actionNames[actionType - 99].actionName;
|
||||
std::wstring name = actionNamesSmv[actionType - 99].actionName;
|
||||
|
||||
std::wcout << name << L"\t\t" << actionType << L"\t(version = " << m_currentActionVersion << L")\t; skiped = " << need_skip << L"\n";
|
||||
}
|
||||
|
||||
@ -11,18 +11,7 @@ TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
QMAKE_CXXFLAGS += -Wall -g
|
||||
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
LIBXML_PUSH_ENABLED \
|
||||
LIBXML_HTML_ENABLED \
|
||||
LIBXML_XPATH_ENABLED \
|
||||
LIBXML_OUTPUT_ENABLED \
|
||||
LIBXML_C14N_ENABLED \
|
||||
LIBXML_SAX1_ENABLED \
|
||||
LIBXML_TREE_ENABLED \
|
||||
LIBXML_XPTR_ENABLED \
|
||||
IN_LIBXML \
|
||||
LIBXML_STATIC
|
||||
CONFIG += core_static_link_xml_full
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
|
||||
@ -19,7 +19,8 @@ PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD_ROOT_DIR/xmlsec/include
|
||||
$$PWD_ROOT_DIR/xmlsec/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/xml/build/qt
|
||||
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
@ -38,15 +39,15 @@ include($$CORE_ROOT_DIR/DesktopEditor/xml/build/qt/libxml2_src.pri)
|
||||
|
||||
DEFINES += PACKAGE=\\\"xmlsec1\\\"
|
||||
DEFINES += VERSION=\\\"1.2.23\\\"
|
||||
DEFINES += XMLSEC_DEFAULT_CRYPTO=\\\"mscrypto\\\"
|
||||
DEFINES += XMLSEC_DEFAULT_CRYPTO=\\\"openssl\\\"
|
||||
|
||||
DEFINES += \
|
||||
IN_XMLSEC \
|
||||
XMLSEC_STATIC
|
||||
|
||||
core_linux {
|
||||
CONFIG += use_gcrypt
|
||||
CONFIG += use_gnutls
|
||||
#CONFIG += use_gcrypt
|
||||
#CONFIG += use_gnutls
|
||||
#CONFIG += use_mscrypto
|
||||
#CONFIG += use_nss
|
||||
CONFIG += use_openssl
|
||||
@ -246,6 +247,10 @@ SOURCES += \
|
||||
|
||||
use_openssl {
|
||||
|
||||
DEFINES += XMLSEC_OPENSSL_110
|
||||
|
||||
INCLUDEPATH += $$PWD/openssl/include
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/openssl/app.h \
|
||||
xmlsec/include/xmlsec/openssl/bn.h \
|
||||
@ -258,21 +263,21 @@ HEADERS += \
|
||||
xmlsec/src/openssl/openssl11_wrapper.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/openssl/app.c \
|
||||
xmlsec/src/openssl/bn.c \
|
||||
xmlsec/src/openssl/ciphers.c \
|
||||
xmlsec/src/openssl/crypto.c \
|
||||
xmlsec/src/openssl/digests.c \
|
||||
xmlsec/src/openssl/evp.c \
|
||||
xmlsec/src/openssl/evp_signatures.c \
|
||||
xmlsec/src/openssl/hmac.c \
|
||||
xmlsec/src/openssl/kt_rsa.c \
|
||||
xmlsec/src/openssl/kw_aes.c \
|
||||
xmlsec/src/openssl/kw_des.c \
|
||||
xmlsec/src/openssl/signatures.c \
|
||||
xmlsec/src/openssl/symkeys.c \
|
||||
xmlsec/src/openssl/x509.c \
|
||||
xmlsec/src/openssl/x509vfy.c
|
||||
xmlsec/src/openssl/_app.c \
|
||||
xmlsec/src/openssl/_bn.c \
|
||||
xmlsec/src/openssl/_ciphers.c \
|
||||
xmlsec/src/openssl/_crypto.c \
|
||||
xmlsec/src/openssl/_digests.c \
|
||||
xmlsec/src/openssl/_evp.c \
|
||||
xmlsec/src/openssl/_evp_signatures.c \
|
||||
xmlsec/src/openssl/_hmac.c \
|
||||
xmlsec/src/openssl/_kt_rsa.c \
|
||||
xmlsec/src/openssl/_kw_aes.c \
|
||||
xmlsec/src/openssl/_kw_des.c \
|
||||
xmlsec/src/openssl/_signatures.c \
|
||||
xmlsec/src/openssl/_symkeys.c \
|
||||
xmlsec/src/openssl/_x509.c \
|
||||
xmlsec/src/openssl/_x509vfy.c
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +77,11 @@ public:
|
||||
|
||||
std::wstring GetImageBase64(const std::wstring& file)
|
||||
{
|
||||
if (0 == file.find(L"data:image/"))
|
||||
{
|
||||
return file.substr(file.find(L",") + 1);
|
||||
}
|
||||
|
||||
BYTE* pData = NULL;
|
||||
DWORD dwLen = 0;
|
||||
if (!NSFile::CFileBinary::ReadAllBytes(file, &pData, dwLen))
|
||||
@ -97,6 +102,8 @@ public:
|
||||
std::wstring GetRelsReference(const std::wstring& file)
|
||||
{
|
||||
COOXMLRelationships oRels(m_sFolder + file, true);
|
||||
if (oRels.rels.size() == 0)
|
||||
return L"";
|
||||
|
||||
if (L"/_rels/.rels" == file)
|
||||
{
|
||||
|
||||
@ -174,7 +174,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring sSetupID = FindFirstChild(GetObjectById("idOfficeObject"), L"SetupID").GetText();
|
||||
XmlUtils::CXmlNode firstChild = GetObjectById("idOfficeObject");
|
||||
std::wstring sSetupID = FindFirstChild(firstChild, L"SetupID").GetText();
|
||||
m_guid = U_TO_UTF8(sSetupID);
|
||||
|
||||
// 2) Images
|
||||
|
||||
294
DesktopEditor/xmlsec/test/openssl_linux/main.cpp
Normal file
294
DesktopEditor/xmlsec/test/openssl_linux/main.cpp
Normal file
@ -0,0 +1,294 @@
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#include "../../../common/File.h"
|
||||
|
||||
static time_t ASN1_GetTimeT(ASN1_TIME* time)
|
||||
{
|
||||
struct tm t;
|
||||
const char* str = (const char*) time->data;
|
||||
size_t i = 0;
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
|
||||
if (time->type == V_ASN1_UTCTIME) {/* two digit year */
|
||||
t.tm_year = (str[i++] - '0') * 10;
|
||||
t.tm_year += (str[i++] - '0');
|
||||
if (t.tm_year < 70)
|
||||
t.tm_year += 100;
|
||||
} else if (time->type == V_ASN1_GENERALIZEDTIME) {/* four digit year */
|
||||
t.tm_year = (str[i++] - '0') * 1000;
|
||||
t.tm_year+= (str[i++] - '0') * 100;
|
||||
t.tm_year+= (str[i++] - '0') * 10;
|
||||
t.tm_year+= (str[i++] - '0');
|
||||
t.tm_year -= 1900;
|
||||
}
|
||||
t.tm_mon = (str[i++] - '0') * 10;
|
||||
t.tm_mon += (str[i++] - '0') - 1; // -1 since January is 0 not 1.
|
||||
t.tm_mday = (str[i++] - '0') * 10;
|
||||
t.tm_mday+= (str[i++] - '0');
|
||||
t.tm_hour = (str[i++] - '0') * 10;
|
||||
t.tm_hour+= (str[i++] - '0');
|
||||
t.tm_min = (str[i++] - '0') * 10;
|
||||
t.tm_min += (str[i++] - '0');
|
||||
t.tm_sec = (str[i++] - '0') * 10;
|
||||
t.tm_sec += (str[i++] - '0');
|
||||
|
||||
/* Note: we did not adjust the time based on time zone information */
|
||||
return mktime(&t);
|
||||
}
|
||||
|
||||
#if 0
|
||||
int main()
|
||||
{
|
||||
std::wstring sFolderW = NSFile::GetProcessDirectory();
|
||||
std::string sFolder = U_TO_UTF8(sFolderW);
|
||||
std::string __file = sFolder + "/settings.xml";
|
||||
std::string __key = sFolder + "/rsakey.pem";
|
||||
std::string __cert = sFolder + "/rsacert.pem";
|
||||
|
||||
ASN1_INTEGER *asn1_serial = NULL;
|
||||
BIO *certbio = NULL;
|
||||
BIO *outbio = NULL;
|
||||
X509 *cert = NULL;
|
||||
const char *neg;
|
||||
int ret, i;
|
||||
long l;
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* These function calls initialize openssl for correct work. *
|
||||
* ---------------------------------------------------------- */
|
||||
OpenSSL_add_all_algorithms();
|
||||
ERR_load_BIO_strings();
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* Create the Input/Output BIO's. *
|
||||
* ---------------------------------------------------------- */
|
||||
certbio = BIO_new(BIO_s_file());
|
||||
outbio = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* Load the certificate from file (PEM). *
|
||||
* ---------------------------------------------------------- */
|
||||
ret = BIO_read_filename(certbio, __cert.c_str());
|
||||
if (! (cert = PEM_read_bio_X509(certbio, NULL, 0, NULL)))
|
||||
{
|
||||
BIO_printf(outbio, "Error loading cert into memory\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* Extract the certificate's serial number. *
|
||||
* ---------------------------------------------------------- */
|
||||
asn1_serial = X509_get_serialNumber(cert);
|
||||
if (asn1_serial == NULL)
|
||||
BIO_printf(outbio, "Error getting serial number from certificate");
|
||||
|
||||
ASN1_TIME* _time = X509_get_notBefore(cert);
|
||||
const char* s = (const char*)_time->data;
|
||||
time_t time1 = ASN1_GetTimeT(_time);
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* Print the serial number value, openssl x509 -serial style *
|
||||
* ---------------------------------------------------------- */
|
||||
BIO_puts(outbio,"serial (openssl x509 -serial style): ");
|
||||
i2a_ASN1_INTEGER(outbio, asn1_serial);
|
||||
BIO_puts(outbio,"\n");
|
||||
|
||||
/* ---------------------------------------------------------- *
|
||||
* Print the serial number value, openssl x509 -text style *
|
||||
* ---------------------------------------------------------- */
|
||||
if (asn1_serial->length <= (int)sizeof(long))
|
||||
{
|
||||
l=ASN1_INTEGER_get(asn1_serial);
|
||||
if (asn1_serial->type == V_ASN1_NEG_INTEGER)
|
||||
{
|
||||
l= -l;
|
||||
neg="-";
|
||||
}
|
||||
else neg="";
|
||||
|
||||
if (BIO_printf(outbio," %s%lu (%s0x%lx)\n",neg,l,neg,l) <= 0)
|
||||
BIO_printf(outbio, "Error during printing the serial.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
neg=(asn1_serial->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
|
||||
//if (BIO_printf(outbio,"\n%12s%s","",neg) <= 0)
|
||||
if (BIO_printf(outbio,"serial (openssl x509 -text style): %s","",neg) <= 0)
|
||||
BIO_printf(outbio, "Error during printing the serial.\n");
|
||||
|
||||
for (i=0; i<asn1_serial->length; i++)
|
||||
{
|
||||
char c[2];
|
||||
c[0] = asn1_serial->data[i];
|
||||
c[1] = '0';
|
||||
BIO_printf(outbio, c);
|
||||
}
|
||||
}
|
||||
|
||||
X509_free(cert);
|
||||
BIO_free_all(certbio);
|
||||
BIO_free_all(outbio);
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::wstring sFolderW = NSFile::GetProcessDirectory();
|
||||
std::string sFolder = U_TO_UTF8(sFolderW);
|
||||
std::string __file = sFolder + "/settings.xml";
|
||||
std::string __key = sFolder + "/rsakey.pem";
|
||||
std::string __cert = sFolder + "/www.pfx";
|
||||
|
||||
std::string __export = sFolder + "/www.pem";
|
||||
|
||||
FILE *fp;
|
||||
EVP_PKEY *pkey;
|
||||
X509 *cert;
|
||||
STACK_OF(X509) *ca = NULL;
|
||||
PKCS12 *p12;
|
||||
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_algorithms();
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
if (!(fp = fopen(__cert.c_str(), "rb")))
|
||||
{
|
||||
fprintf(stderr, "Error opening file %s\n", __cert.c_str());
|
||||
exit(1);
|
||||
}
|
||||
p12 = d2i_PKCS12_fp(fp, NULL);
|
||||
fclose (fp);
|
||||
|
||||
if (!p12)
|
||||
{
|
||||
fprintf(stderr, "Error reading PKCS#12 file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!PKCS12_parse(p12, "111", &pkey, &cert, &ca))
|
||||
{
|
||||
fprintf(stderr, "Error parsing PKCS#12 file\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
exit (1);
|
||||
}
|
||||
PKCS12_free(p12);
|
||||
|
||||
if (!(fp = fopen(__export.c_str(), "w")))
|
||||
{
|
||||
fprintf(stderr, "Error opening file %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
if (pkey)
|
||||
{
|
||||
fprintf(fp, "***Private Key***\n");
|
||||
PEM_write_PrivateKey(fp, pkey, NULL, NULL, 0, NULL, NULL);
|
||||
}
|
||||
if (cert)
|
||||
{
|
||||
fprintf(fp, "***User Certificate***\n");
|
||||
PEM_write_X509_AUX(fp, cert);
|
||||
}
|
||||
if (ca && sk_X509_num(ca))
|
||||
{
|
||||
fprintf(fp, "***Other Certificates***\n");
|
||||
int count = sk_X509_num(ca);
|
||||
for (int i = 0; i < count; i++)
|
||||
PEM_write_X509_AUX(fp, sk_X509_value(ca, i));
|
||||
}
|
||||
|
||||
sk_X509_pop_free(ca, X509_free);
|
||||
X509_free(cert);
|
||||
EVP_PKEY_free(pkey);
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int main()
|
||||
{
|
||||
unsigned char ibuf[] = "compute sha1";
|
||||
unsigned char obuf[20];
|
||||
|
||||
SHA1(ibuf, strlen((char*)ibuf), obuf);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 20; i++) {
|
||||
printf("%02x ", obuf[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int main()
|
||||
{
|
||||
std::wstring sFolderW = NSFile::GetProcessDirectory();
|
||||
std::string sFolder = U_TO_UTF8(sFolderW);
|
||||
std::string __file = sFolder + "/settings.xml";
|
||||
|
||||
#if 1
|
||||
std::string __key = sFolder + "/www.pem";
|
||||
std::string __cert = sFolder + "/www.pem";
|
||||
#else
|
||||
std::string __key = sFolder + "/rsakey.pem";
|
||||
std::string __cert = sFolder + "/rsacert.pem";
|
||||
#endif
|
||||
|
||||
OpenSSL_add_all_algorithms();
|
||||
ERR_load_BIO_strings();
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
FILE* file_key = NSFile::CFileBinary::OpenFileNative(UTF8_TO_U(__key), L"r+");
|
||||
FILE* file_cert = NSFile::CFileBinary::OpenFileNative(UTF8_TO_U(__key), L"r+");
|
||||
|
||||
EVP_PKEY* pKey = NULL;
|
||||
PEM_read_PrivateKey(file_key, &pKey, NULL, NULL);
|
||||
|
||||
X509* pCert = NULL;
|
||||
PEM_read_X509(file_cert, &pCert, NULL, NULL);
|
||||
|
||||
EVP_MD_CTX* pCtx = EVP_MD_CTX_create();
|
||||
const EVP_MD* pDigest = EVP_sha1();
|
||||
|
||||
int n1 = EVP_SignInit(pCtx, pDigest);
|
||||
|
||||
BYTE* pDataSrc = NULL;
|
||||
DWORD nDataSrcLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(UTF8_TO_U(__file), &pDataSrc, nDataSrcLen);
|
||||
|
||||
int n2 = EVP_SignUpdate(pCtx, pDataSrc, (size_t)nDataSrcLen);
|
||||
|
||||
BYTE pSignature[4096];
|
||||
unsigned int nSignatureLen = 0;
|
||||
|
||||
int n3 = EVP_SignFinal(pCtx, pSignature, &nSignatureLen, pKey);
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataSrc);
|
||||
|
||||
EVP_PKEY_free(pKey);
|
||||
X509_free(pCert);
|
||||
|
||||
EVP_MD_CTX_destroy(pCtx);
|
||||
|
||||
fclose(file_key);
|
||||
fclose(file_cert);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
24
DesktopEditor/xmlsec/test/openssl_linux/test.pro
Normal file
24
DesktopEditor/xmlsec/test/openssl_linux/test.pro
Normal file
@ -0,0 +1,24 @@
|
||||
QT -= core gui
|
||||
|
||||
TARGET = test
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
DEFINES -= \
|
||||
UNICODE \
|
||||
_UNICODE
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
DEFINES += XMLSEC_OPENSSL_110
|
||||
|
||||
INCLUDEPATH += $$PWD/../../openssl/include
|
||||
|
||||
LIBS += -L$$PWD/../../openssl -lssl -lcrypto
|
||||
LIBS += -ldl
|
||||
|
||||
SOURCES += main.cpp
|
||||
@ -42,6 +42,8 @@
|
||||
#include <xmlsec/templates.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
#include "../../../common/File.h"
|
||||
|
||||
int sign_file(const char* xml_file, const char* key_file, const char* cert_file);
|
||||
|
||||
int
|
||||
@ -50,13 +52,11 @@ main(int argc, char **argv) {
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 4) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <xml-file> <key-file> <cert-file>\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
std::wstring sFolderW = NSFile::GetProcessDirectory();
|
||||
std::string sFolder = U_TO_UTF8(sFolderW);
|
||||
std::string __file = sFolder + "/settings.xml";
|
||||
std::string __key = sFolder + "/rsakey.pem";
|
||||
std::string __cert = sFolder + "/rsacert.pem";
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
@ -117,7 +117,7 @@ main(int argc, char **argv) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(sign_file(argv[1], argv[2], argv[3]) < 0) {
|
||||
if(sign_file(__file.c_str(), __key.c_str(), __cert.c_str()) < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
#DEFINES += XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
DEFINES += XMLSEC_CRYPTO_MSCRYPTO
|
||||
DEFINES += XMLSEC_CRYPTO_OPENSSL
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/xml/libxml2/include \
|
||||
@ -40,8 +40,8 @@ DEFINES += XMLSEC_STATIC
|
||||
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxmlsec
|
||||
|
||||
LIBS += -lcrypt32
|
||||
LIBS += -lcryptui
|
||||
LIBS += -lAdvapi32
|
||||
LIBS += -L$$PWD/../../openssl -lcrypto -lssl
|
||||
|
||||
LIBS += -ldl
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
56
Makefile
56
Makefile
@ -18,6 +18,7 @@ else
|
||||
SHARED_EXT := .so*
|
||||
SHELL_EXT := .sh
|
||||
LIB_EXT := .a
|
||||
LIB_PREFIX := lib
|
||||
MAKE := make -j $(shell grep -c ^processor /proc/cpuinfo)
|
||||
endif
|
||||
UNAME_P := $(shell uname -p)
|
||||
@ -36,29 +37,30 @@ LIBDIR := build/lib/$(TARGET)
|
||||
ALLFONTSGEN := build/bin/AllFontsGen/$(TARGET)$(EXEC_EXT)
|
||||
X2T := build/bin/$(TARGET)/x2t$(EXEC_EXT)
|
||||
HTMLFILEINTERNAL := $(LIBDIR)/HtmlFileInternal$(EXEC_EXT)
|
||||
XLSFORMATLIB := $(LIBDIR)/libXlsFormatLib$(LIB_EXT)
|
||||
ODFFILEWRITERLIB := $(LIBDIR)/libOdfFileWriterLib$(LIB_EXT)
|
||||
ODFFILEREADERLIB := $(LIBDIR)/libOdfFileReaderLib$(LIB_EXT)
|
||||
DOCFORMATLIB := $(LIBDIR)/libDocFormatLib$(LIB_EXT)
|
||||
PPTFORMATLIB := $(LIBDIR)/libPptFormatLib$(LIB_EXT)
|
||||
RTFFORMATLIB := $(LIBDIR)/libRtfFormatLib$(LIB_EXT)
|
||||
TXTXMLFORMATLIB := $(LIBDIR)/libTxtXmlFormatLib$(LIB_EXT)
|
||||
PDFWRITER := $(LIBDIR)/libPdfWriter$(SHARED_EXT)
|
||||
ASCOFFICEDOCXFILE2LIB := $(LIBDIR)/libASCOfficeDocxFile2Lib$(LIB_EXT)
|
||||
PPTXFORMATLIB := $(LIBDIR)/libPPTXFormatLib$(LIB_EXT)
|
||||
DOCXFORMATLIB := $(LIBDIR)/libDocxFormatLib$(LIB_EXT)
|
||||
OFFICEUTILS := $(LIBDIR)/libOfficeUtils$(LIB_EXT)
|
||||
GRAPHICS := $(LIBDIR)/libgraphics$(LIB_EXT)
|
||||
DOCTRENDERER := $(LIBDIR)/libdoctrenderer$(SHARED_EXT)
|
||||
HTMLRENDERER := $(LIBDIR)/libHtmlRenderer$(SHARED_EXT)
|
||||
PDFREADER := $(LIBDIR)/libPdfReader$(SHARED_EXT)
|
||||
DJVUFILE := $(LIBDIR)/libDjVuFile$(SHARED_EXT)
|
||||
XPSFILE := $(LIBDIR)/libXpsFile$(SHARED_EXT)
|
||||
HTMLFILE := $(LIBDIR)/libHtmlFile$(SHARED_EXT)
|
||||
UNICODECONVERTER := $(LIBDIR)/libUnicodeConverter$(SHARED_EXT)
|
||||
ASCDOCUMENTSCORE := $(LIBDIR)/libascdocumentscore$(SHARED_EXT)
|
||||
LIBXML := $(LIBDIR)/liblibxml$(LIB_EXT)
|
||||
LICENSEMANAGER := $(LIBDIR)/libLicenceManager$(LIB_EXT)
|
||||
XLSFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)XlsFormatLib$(LIB_EXT)
|
||||
ODFFILEWRITERLIB := $(LIBDIR)/$(LIB_PREFIX)OdfFileWriterLib$(LIB_EXT)
|
||||
ODFFILEREADERLIB := $(LIBDIR)/$(LIB_PREFIX)OdfFileReaderLib$(LIB_EXT)
|
||||
DOCFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)DocFormatLib$(LIB_EXT)
|
||||
PPTFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)PptFormatLib$(LIB_EXT)
|
||||
RTFFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)RtfFormatLib$(LIB_EXT)
|
||||
TXTXMLFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)TxtXmlFormatLib$(LIB_EXT)
|
||||
PDFWRITER := $(LIBDIR)/$(LIB_PREFIX)PdfWriter$(SHARED_EXT)
|
||||
ASCOFFICEDOCXFILE2LIB := $(LIBDIR)/$(LIB_PREFIX)ASCOfficeDocxFile2Lib$(LIB_EXT)
|
||||
PPTXFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)PPTXFormatLib$(LIB_EXT)
|
||||
DOCXFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)DocxFormatLib$(LIB_EXT)
|
||||
OFFICEUTILS := $(LIBDIR)/$(LIB_PREFIX)OfficeUtils$(LIB_EXT)
|
||||
GRAPHICS := $(LIBDIR)/$(LIB_PREFIX)graphics$(LIB_EXT)
|
||||
DOCTRENDERER := $(LIBDIR)/$(LIB_PREFIX)doctrenderer$(SHARED_EXT)
|
||||
HTMLRENDERER := $(LIBDIR)/$(LIB_PREFIX)HtmlRenderer$(SHARED_EXT)
|
||||
PDFREADER := $(LIBDIR)/$(LIB_PREFIX)PdfReader$(SHARED_EXT)
|
||||
DJVUFILE := $(LIBDIR)/$(LIB_PREFIX)DjVuFile$(SHARED_EXT)
|
||||
XPSFILE := $(LIBDIR)/$(LIB_PREFIX)XpsFile$(SHARED_EXT)
|
||||
HTMLFILE := $(LIBDIR)/$(LIB_PREFIX)HtmlFile$(SHARED_EXT)
|
||||
UNICODECONVERTER := $(LIBDIR)/$(LIB_PREFIX)UnicodeConverter$(SHARED_EXT)
|
||||
ASCDOCUMENTSCORE := $(LIBDIR)/$(LIB_PREFIX)ascdocumentscore$(SHARED_EXT)
|
||||
LIBXML := $(LIBDIR)/$(LIB_PREFIX)libxml$(LIB_EXT)
|
||||
LICENSEMANAGER := $(LIBDIR)/$(LIB_PREFIX)LicenceManager$(LIB_EXT)
|
||||
OOXMLSIGNATURE := $(LIBDIR)/$(LIB_PREFIX)ooxmlsignature$(LIB_EXT)
|
||||
|
||||
TARGETS += $(ALLFONTSGEN)
|
||||
TARGETS += $(X2T)
|
||||
@ -86,6 +88,7 @@ TARGETS += $(UNICODECONVERTER)
|
||||
TARGETS += $(ASCDOCUMENTSCORE)
|
||||
TARGETS += $(LIBXML)
|
||||
TARGETS += $(LICENSEMANAGER)
|
||||
TARGETS += $(OOXMLSIGNATURE)
|
||||
|
||||
X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro)
|
||||
HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro)
|
||||
@ -113,6 +116,7 @@ UNICODECONVERTER_PRO := $(abspath UnicodeConverter/UnicodeConverter.pro)
|
||||
ASCDOCUMENTSCORE_PRO := $(abspath ../desktop-sdk/ChromiumBasedEditors/lib/AscDocumentsCore_$(PLATFORM).pro)
|
||||
LIBXML_PRO := $(abspath DesktopEditor/xml/build/qt/libxml2.pro)
|
||||
LICENSEMANAGER_PRO := $(abspath LicenceManager/linux/LicenseManager.pro)
|
||||
OOXMLSIGNATURE_PRO := $(abspath DesktopEditor/xmlsec/src/ooxmlsignature.pro)
|
||||
|
||||
# PROS += $(basename $(X2T_PRO)).build
|
||||
# PROS += ALLFONTSGEN_PRO
|
||||
@ -163,6 +167,7 @@ QT_PROJ += UNICODECONVERTER
|
||||
QT_PROJ += ASCDOCUMENTSCORE
|
||||
QT_PROJ += LIBXML
|
||||
QT_PROJ += LICENSEMANAGER
|
||||
QT_PROJ += OOXMLSIGNATURE
|
||||
|
||||
# X2T_DEP += $(XLSFORMATLIB)
|
||||
# X2T_DEP += $(ODFFILEWRITERLIB)
|
||||
@ -211,6 +216,9 @@ ASCDOCUMENTSCORE_DEP += $(DJVUFILE)
|
||||
ASCDOCUMENTSCORE_DEP += $(XPSFILE)
|
||||
#ASCDOCUMENTSCORE_DEP += $(LICENSEMANAGER)
|
||||
ASCDOCUMENTSCORE_DEP += $(LIBXML)
|
||||
ASCDOCUMENTSCORE_DEP += $(OOXMLSIGNATURE)
|
||||
|
||||
OOXMLSIGNATURE_DEP += $(LIBXML)
|
||||
|
||||
PDFREADER_DEP += $(HTMLRENDERER)
|
||||
|
||||
@ -262,6 +270,8 @@ $(PDFREADER): $(PDFREADER_DEP)
|
||||
|
||||
$(PDFWRITER): $(PDFWRITER_DEP)
|
||||
|
||||
$(OOXMLSIGNATURE): $(OOXMLSIGNATURE_DEP)
|
||||
|
||||
%.build/Makefile: %.pro
|
||||
mkdir -p $(dir $@) && cd $(dir $@) && qmake -r $<
|
||||
|
||||
|
||||
@ -12,9 +12,11 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
std::wstring password = L"password";
|
||||
|
||||
ECMACryptFile crypt_file;
|
||||
crypt_file.DecryptOfficeFile(srcFileName, dstFileName, password);
|
||||
bool result, bDataIntegrity;
|
||||
|
||||
result = crypt_file.DecryptOfficeFile(srcFileName, dstFileName, password, bDataIntegrity);
|
||||
|
||||
crypt_file.EncryptOfficeFile(dstFileName, dstFileName2, password);
|
||||
result = crypt_file.EncryptOfficeFile(dstFileName, dstFileName2, password);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -177,34 +177,40 @@ void CorrectHashSize(_buf & hashBuf, int size, unsigned char padding)
|
||||
}
|
||||
_buf Hmac(_buf & buf, CRYPT_METHOD::_hashAlgorithm algorithm, std::string & plain)
|
||||
{
|
||||
std::string mac;
|
||||
if (algorithm == CRYPT_METHOD::SHA1)
|
||||
{
|
||||
CryptoPP::HMAC<CryptoPP::SHA1> hmac(buf.ptr, buf.size);
|
||||
|
||||
//return _buf(mac.BytePtr(), mac.SizeInBytes());
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::SHA256)
|
||||
{
|
||||
CryptoPP::HMAC<CryptoPP::SHA256> hmac(buf.ptr, buf.size);
|
||||
|
||||
//return _buf(mac.BytePtr(), mac.SizeInBytes());
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::SHA512)
|
||||
{
|
||||
CryptoPP::HMAC<CryptoPP::SHA512> hmac(buf.ptr, buf.size);
|
||||
|
||||
std::string mac;
|
||||
CryptoPP::StringSource(plain, true,
|
||||
new CryptoPP::HashFilter(hmac,
|
||||
new CryptoPP::StringSink(mac)
|
||||
) // HashFilter
|
||||
); // StringSource
|
||||
|
||||
return _buf(mac);
|
||||
}
|
||||
else if (algorithm == CRYPT_METHOD::SHA256)
|
||||
{
|
||||
CryptoPP::HMAC<CryptoPP::SHA256> hmac(buf.ptr, buf.size);
|
||||
CryptoPP::StringSource(plain, true,
|
||||
new CryptoPP::HashFilter(hmac,
|
||||
new CryptoPP::StringSink(mac)
|
||||
) // HashFilter
|
||||
); // StringSource
|
||||
|
||||
}
|
||||
//else
|
||||
return _buf();
|
||||
else if (algorithm == CRYPT_METHOD::SHA512)
|
||||
{
|
||||
CryptoPP::HMAC<CryptoPP::SHA512> hmac(buf.ptr, buf.size);
|
||||
|
||||
CryptoPP::StringSource(plain, true,
|
||||
new CryptoPP::HashFilter(hmac,
|
||||
new CryptoPP::StringSink(mac)
|
||||
) // HashFilter
|
||||
); // StringSource
|
||||
|
||||
}
|
||||
|
||||
return _buf(mac);
|
||||
}
|
||||
|
||||
|
||||
@ -488,8 +494,10 @@ void ECMADecryptor::Decrypt(char* data , const size_t size, const unsigned long
|
||||
}
|
||||
}
|
||||
}
|
||||
bool ECMADecryptor::IsDataIntegrity(unsigned char* data, int size)
|
||||
bool ECMADecryptor::CheckDataIntegrity(unsigned char* data, int size)
|
||||
{
|
||||
if (cryptData.bAgile == false) return true;
|
||||
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pBlockHmacKey ((unsigned char*)encrDataIntegritySaltBlockKey, 8);
|
||||
_buf pBlockHmacValue((unsigned char*)encrDataIntegrityHmacValueBlockKey, 8);
|
||||
@ -514,15 +522,15 @@ bool ECMADecryptor::IsDataIntegrity(unsigned char* data, int size)
|
||||
_buf iv2 = HashAppend(pDataSalt, pBlockHmacValue, cryptData.hashAlgorithm);
|
||||
CorrectHashSize(iv2, cryptData.blockSize, 0x36);
|
||||
|
||||
_buf salt;
|
||||
DecryptCipher(secretKey, iv1, pEncHmacKey, salt, cryptData.cipherAlgorithm);
|
||||
_buf pSaltHmac;
|
||||
DecryptCipher(secretKey, iv1, pEncHmacKey, pSaltHmac, cryptData.cipherAlgorithm);
|
||||
|
||||
_buf expected;
|
||||
DecryptCipher(secretKey, iv2, pEncHmacValue, expected, cryptData.cipherAlgorithm);
|
||||
|
||||
std::string sData((char*)data, size);
|
||||
_buf hmac = Hmac(salt, cryptData.hashAlgorithm, sData);
|
||||
|
||||
_buf hmac = Hmac(pSaltHmac, cryptData.hashAlgorithm, sData);
|
||||
|
||||
return (hmac == expected);
|
||||
}
|
||||
void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned char*& data_out)
|
||||
@ -540,8 +548,6 @@ void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned ch
|
||||
|
||||
if (cryptData.bAgile)
|
||||
{
|
||||
bool isDataIntegrity = IsDataIntegrity(data_ptr, data_size);
|
||||
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pDataSalt (cryptData.dataSaltValue);
|
||||
_buf pKeyValue (cryptData.encryptedKeyValue);
|
||||
@ -603,6 +609,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_ptr, int data_size, unsigned ch
|
||||
DecryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
ECMAEncryptor::ECMAEncryptor()
|
||||
{
|
||||
@ -611,6 +618,65 @@ ECMAEncryptor::ECMAEncryptor()
|
||||
void ECMAEncryptor::SetPassword(std::wstring _password)
|
||||
{
|
||||
password = _password;
|
||||
|
||||
//---------
|
||||
CryptoPP::RandomPool prng;
|
||||
|
||||
//сгенерить соль
|
||||
CryptoPP::SecByteBlock seed_salt(cryptData.saltSize);
|
||||
CryptoPP::OS_GenerateRandomBlock(false, seed_salt, seed_salt.size());
|
||||
prng.IncorporateEntropy(seed_salt, seed_salt.size());
|
||||
|
||||
CryptoPP::SecByteBlock seed_datasalt(cryptData.saltSize);
|
||||
CryptoPP::OS_GenerateRandomBlock(false, seed_datasalt, seed_datasalt.size());
|
||||
prng.IncorporateEntropy(seed_datasalt, seed_datasalt.size());
|
||||
|
||||
//сгенерить ключ
|
||||
CryptoPP::SecByteBlock seed_key(cryptData.keySize);
|
||||
CryptoPP::OS_GenerateRandomBlock(false, seed_key, seed_key.size());
|
||||
prng.IncorporateEntropy(seed_key, seed_key.size());
|
||||
|
||||
//сгенерить проверочный
|
||||
CryptoPP::SecByteBlock seed_verify(cryptData.saltSize);
|
||||
CryptoPP::OS_GenerateRandomBlock(false, seed_verify, seed_verify.size());
|
||||
prng.IncorporateEntropy(seed_verify, seed_verify.size());
|
||||
//---------
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
_buf pInputBlockKey ((unsigned char*)encrVerifierHashInputBlockKey, 8);
|
||||
_buf pValueBlockKey ((unsigned char*)encrVerifierHashValueBlockKey, 8);
|
||||
|
||||
_buf pSalt (seed_salt.m_ptr, seed_salt.m_size);
|
||||
_buf pDataSalt (seed_datasalt.m_ptr, seed_datasalt.m_size);
|
||||
_buf pDecryptedKey (seed_key.m_ptr, seed_key.m_size);
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf pKeyValue;
|
||||
EncryptCipher( agileKey, pSalt, pDecryptedKey, pKeyValue, cryptData.cipherAlgorithm);
|
||||
|
||||
//--------------------------------------------
|
||||
_buf decryptedVerifierHashInputBytes(seed_verify.m_ptr, seed_verify.m_size);
|
||||
_buf verifierInputKey = GenerateAgileKey( pSalt, pPassword, pInputBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm );
|
||||
|
||||
_buf pEncVerInput;
|
||||
EncryptCipher( verifierInputKey, pSalt, decryptedVerifierHashInputBytes, pEncVerInput, cryptData.cipherAlgorithm);
|
||||
//--------------------------------------------
|
||||
|
||||
_buf decryptedVerifierHashBytes = HashAppend(decryptedVerifierHashInputBytes, empty, cryptData.hashAlgorithm);
|
||||
_buf verifierHashKey = GenerateAgileKey(pSalt, pPassword, pValueBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf pEncVerValue;
|
||||
EncryptCipher( verifierHashKey, pSalt, decryptedVerifierHashBytes, pEncVerValue, cryptData.cipherAlgorithm);
|
||||
|
||||
cryptData.saltValue = std::string((char*)pSalt.ptr, pSalt.size);
|
||||
cryptData.dataSaltValue = std::string((char*)pDataSalt.ptr, pDataSalt.size);
|
||||
cryptData.encryptedKeyValue = std::string((char*)pKeyValue.ptr, pKeyValue.size);
|
||||
cryptData.encryptedVerifierInput = std::string((char*)pEncVerInput.ptr, pEncVerInput.size);
|
||||
cryptData.encryptedVerifierValue = std::string((char*)pEncVerValue.ptr, pEncVerValue.size);
|
||||
}
|
||||
|
||||
void ECMAEncryptor::SetCryptData(_ecmaCryptData & data)
|
||||
@ -622,6 +688,7 @@ void ECMAEncryptor::GetCryptData(_ecmaCryptData &data)
|
||||
{
|
||||
data = cryptData;
|
||||
}
|
||||
|
||||
void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
|
||||
{
|
||||
if (cryptData.bAgile == false) return;
|
||||
@ -636,31 +703,41 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
|
||||
|
||||
_buf pDataSalt (cryptData.dataSaltValue);
|
||||
_buf pKeyValue (cryptData.encryptedKeyValue);
|
||||
_buf pEncHmacKey (cryptData.encryptedHmacKey);
|
||||
_buf pEncHmacValue (cryptData.encryptedHmacValue);
|
||||
|
||||
|
||||
//----
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
_buf secretKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, secretKey, cryptData.cipherAlgorithm);
|
||||
//----
|
||||
|
||||
_buf iv1 = HashAppend(pDataSalt, pBlockHmacKey, cryptData.hashAlgorithm);
|
||||
CorrectHashSize(iv1, cryptData.blockSize, 0x36);
|
||||
|
||||
_buf iv2 = HashAppend(pDataSalt, pBlockHmacValue, cryptData.hashAlgorithm);
|
||||
CorrectHashSize(iv2, cryptData.blockSize, 0x36);
|
||||
|
||||
_buf salt;
|
||||
DecryptCipher(secretKey, iv1, pEncHmacKey, salt, cryptData.cipherAlgorithm);
|
||||
//----
|
||||
CryptoPP::RandomPool prng;
|
||||
CryptoPP::SecByteBlock seed(cryptData.hashSize);
|
||||
|
||||
CryptoPP::OS_GenerateRandomBlock(false, seed, seed.size());
|
||||
prng.IncorporateEntropy(seed, seed.size());
|
||||
|
||||
_buf expected;
|
||||
DecryptCipher(secretKey, iv2, pEncHmacValue, expected, cryptData.cipherAlgorithm);
|
||||
_buf pSaltHmac(seed.m_ptr, seed.m_size);
|
||||
|
||||
std::string sData((char*)data, size);
|
||||
_buf hmac = Hmac(salt, cryptData.hashAlgorithm, sData);
|
||||
|
||||
//return (hmac == expected);
|
||||
_buf hmac = Hmac(pSaltHmac, cryptData.hashAlgorithm, sData);
|
||||
|
||||
_buf pEncHmacKey;
|
||||
EncryptCipher(secretKey, iv1, pSaltHmac, pEncHmacKey, cryptData.cipherAlgorithm);
|
||||
|
||||
_buf pEncHmacValue;
|
||||
EncryptCipher(secretKey, iv2, hmac, pEncHmacValue, cryptData.cipherAlgorithm);
|
||||
|
||||
cryptData.encryptedHmacKey = std::string((char*)pEncHmacKey.ptr, pEncHmacKey.size);
|
||||
cryptData.encryptedHmacValue = std::string((char*)pEncHmacValue.ptr, pEncHmacValue.size);
|
||||
}
|
||||
|
||||
int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*& data_out_ptr)
|
||||
{
|
||||
data_out_ptr = NULL;
|
||||
@ -686,19 +763,17 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
_buf pKeyValue (cryptData.encryptedKeyValue);
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//соль нужно сгенерить
|
||||
|
||||
_buf agileKey = GenerateAgileKey( pSalt, pPassword, pBlockKey, cryptData.keySize, cryptData.spinCount, cryptData.hashAlgorithm);
|
||||
|
||||
//тут нужно именно дешифрованый генерить - пока их файла берем
|
||||
_buf pDecryptedKey;
|
||||
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
|
||||
|
||||
//зашифровать ключь
|
||||
_buf pEncryptedKey;
|
||||
EncryptCipher( agileKey, pSalt, pDecryptedKey, pEncryptedKey, cryptData.cipherAlgorithm);
|
||||
////зашифровать ключь
|
||||
//_buf pEncryptedKey;
|
||||
//EncryptCipher( agileKey, pSalt, pDecryptedKey, pEncryptedKey, cryptData.cipherAlgorithm);
|
||||
|
||||
//??? pEncryptedKey == pKeyValue;
|
||||
////??? pEncryptedKey == pKeyValue;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
_buf iv(cryptData.blockSize);
|
||||
|
||||
@ -133,11 +133,12 @@ public:
|
||||
virtual bool SetPassword (std::wstring password);
|
||||
virtual bool IsVerify();
|
||||
|
||||
bool CheckDataIntegrity(unsigned char* data, int size);
|
||||
|
||||
void SetCryptData(_ecmaCryptData &data);
|
||||
|
||||
private:
|
||||
bool IsDataIntegrity(unsigned char* data, int size);
|
||||
|
||||
|
||||
std::wstring password;
|
||||
_ecmaCryptData cryptData;
|
||||
bool bVerify;
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include "../../ASCOfficeDocFile/DocDocxConverter/MemoryStream.h"
|
||||
#include "simple_xml_writer.h"
|
||||
|
||||
CRYPT::_ecmaCryptData cryptDataGlobal;
|
||||
//CRYPT::_ecmaCryptData cryptDataGlobal; for Test
|
||||
|
||||
using namespace CRYPT;
|
||||
|
||||
@ -489,19 +489,19 @@ bool ECMACryptFile::EncryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
_ecmaCryptData cryptData;
|
||||
|
||||
cryptData.bAgile = true;
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA256;
|
||||
cryptData.hashAlgorithm = CRYPT_METHOD::SHA512;
|
||||
cryptData.keySize = 0x20;
|
||||
cryptData.hashSize = 0x40;
|
||||
cryptData.blockSize = 0x10;
|
||||
cryptData.saltSize = 0x10;
|
||||
|
||||
ECMAEncryptor cryptor;
|
||||
|
||||
//cryptor.SetCryptData(cryptDataGlobal); //for test !!!
|
||||
cryptor.SetCryptData(cryptData); //basic settings
|
||||
|
||||
cryptor.SetPassword(password);
|
||||
|
||||
cryptor.SetCryptData(cryptDataGlobal); //for test !!!
|
||||
//cryptor.SetCryptData(cryptData); //basic settings
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if (!file.OpenFile(file_name_inp)) return false;
|
||||
|
||||
@ -575,6 +575,9 @@ bool ECMACryptFile::EncryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
{
|
||||
unsigned char* data_out2 = NULL;
|
||||
decryptor.Decrypt(data_out, lengthData, data_out2);
|
||||
|
||||
bool bDataIntegrity = decryptor.CheckDataIntegrity(data_out, lengthData);
|
||||
|
||||
NSFile::CFileBinary test;
|
||||
|
||||
test.CreateFileW(file_name_out + L"-back.oox");
|
||||
@ -586,8 +589,10 @@ bool ECMACryptFile::EncryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password)
|
||||
bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password, bool & bDataIntegrity)
|
||||
{
|
||||
bDataIntegrity = false;
|
||||
|
||||
POLE::Storage *pStorage = new POLE::Storage(file_name_inp.c_str());
|
||||
|
||||
if (!pStorage)return false;
|
||||
@ -597,45 +602,10 @@ bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
delete pStorage;
|
||||
return false;
|
||||
}
|
||||
_ecmaCryptData cryptData;
|
||||
//-------------------------------------------------------------------------------------------
|
||||
_ecmaCryptData cryptData;
|
||||
bool result = false;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//{
|
||||
// std::wstring f = file_name_out + L"-1.docx";
|
||||
// POLE::Storage *pStorage1 = new POLE::Storage(f.c_str());
|
||||
// pStorage1->open(true, true);
|
||||
|
||||
// POLE::Stream *pStrIn = new POLE::Stream(pStorage, "EncryptionInfo");
|
||||
// POLE::uint64 sz = pStrIn->size();
|
||||
// POLE::Stream *pStrOut = new POLE::Stream(pStorage1, "EncryptionInfo", true, sz);
|
||||
|
||||
// BYTE *d = new BYTE [sz];
|
||||
// pStrIn->read(d, sz);
|
||||
// pStrOut->write(d, sz);
|
||||
// delete d;
|
||||
|
||||
// pStrOut->flush();
|
||||
// delete pStrOut;
|
||||
// delete pStrIn;
|
||||
|
||||
// pStrIn = new POLE::Stream(pStorage, "EncryptedPackage");
|
||||
// sz = pStrIn->size();
|
||||
// pStrOut = new POLE::Stream(pStorage1, "EncryptedPackage", true, sz);
|
||||
|
||||
// d = new BYTE [sz];
|
||||
// pStrIn->read(d, sz);
|
||||
// pStrOut->write(d, sz);
|
||||
// delete d;
|
||||
|
||||
// pStrOut->flush();
|
||||
// delete pStrOut;
|
||||
// delete pStrIn;
|
||||
|
||||
// pStorage1->close();
|
||||
// delete pStorage1;
|
||||
//}
|
||||
//----------------------------------------------------------------------------
|
||||
POLE::Stream *pStream = new POLE::Stream(pStorage, "EncryptionInfo");
|
||||
|
||||
if (pStream)
|
||||
@ -747,8 +717,6 @@ bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
lengthData = *((_UINT64*)data);
|
||||
|
||||
decryptor.Decrypt(data, readTrue, data_out);//todoo сделать покусочное чтение декриптование
|
||||
delete pStream;
|
||||
delete []data;
|
||||
|
||||
if (data_out)
|
||||
{
|
||||
@ -760,11 +728,16 @@ bool ECMACryptFile::DecryptOfficeFile(std::wstring file_name_inp, std::wstring f
|
||||
delete []data_out;
|
||||
result = true;
|
||||
}
|
||||
|
||||
bDataIntegrity = decryptor.CheckDataIntegrity(data, readTrue);
|
||||
|
||||
delete pStream;
|
||||
delete []data;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
delete pStorage;
|
||||
|
||||
cryptDataGlobal = cryptData;
|
||||
//cryptDataGlobal = cryptData; // for encrypt like sample & test
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
class ECMACryptFile
|
||||
{
|
||||
public:
|
||||
bool DecryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password);
|
||||
bool DecryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password, bool & bDataIntegrity);
|
||||
bool EncryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password);
|
||||
|
||||
struct _refComponent
|
||||
|
||||
@ -138,22 +138,158 @@ namespace ParseAllCultureInfo
|
||||
{
|
||||
var index = aTemp[i];
|
||||
if(nIndexD == index)
|
||||
sShortDatePattern += "0";
|
||||
else if (nIndexM == index)
|
||||
sShortDatePattern += "1";
|
||||
{
|
||||
if (nIndexD + 1 < ShortDatePatternLower.Length && 'd' == ShortDatePatternLower[nIndexD + 1])
|
||||
{
|
||||
sShortDatePattern += "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
sShortDatePattern += "0";
|
||||
}
|
||||
} else if (nIndexM == index)
|
||||
{
|
||||
if (nIndexM + 1 < ShortDatePatternLower.Length && 'm' == ShortDatePatternLower[nIndexM + 1])
|
||||
{
|
||||
sShortDatePattern += "3";
|
||||
}
|
||||
else
|
||||
{
|
||||
sShortDatePattern += "2";
|
||||
}
|
||||
}
|
||||
else if (nIndexY == index)
|
||||
sShortDatePattern += "2";
|
||||
{
|
||||
if (nIndexY + 2 < ShortDatePatternLower.Length && 'y' == ShortDatePatternLower[nIndexY + 2])
|
||||
{
|
||||
sShortDatePattern += "5";
|
||||
}
|
||||
else
|
||||
{
|
||||
sShortDatePattern += "4";
|
||||
}
|
||||
}
|
||||
}
|
||||
ShortDatePattern = sShortDatePattern;
|
||||
}
|
||||
}
|
||||
static Dictionary<int, int> g_mapUsedValues = new Dictionary<int, int>() {
|
||||
{4, 1},
|
||||
{5, 1},
|
||||
{7, 1},
|
||||
{8, 1},
|
||||
{9, 1},
|
||||
{10, 1},
|
||||
{11, 1},
|
||||
{12, 1},
|
||||
{16, 1},
|
||||
{17, 1},
|
||||
{18, 1},
|
||||
{21, 1},
|
||||
{22, 1},
|
||||
{25, 1},
|
||||
{31, 1},
|
||||
{34, 1},
|
||||
{36, 1},
|
||||
{38, 1},
|
||||
{42, 1},
|
||||
{44, 1},
|
||||
{1028, 1},
|
||||
{1029, 1},
|
||||
{1031, 1},
|
||||
{1032, 1},
|
||||
{1033, 1},
|
||||
{1035, 1},
|
||||
{1036, 1},
|
||||
{1040, 1},
|
||||
{1041, 1},
|
||||
{1042, 1},
|
||||
{1045, 1},
|
||||
{1046, 1},
|
||||
{1049, 1},
|
||||
{1055, 1},
|
||||
{1058, 1},
|
||||
{1060, 1},
|
||||
{1062, 1},
|
||||
{1066, 1},
|
||||
{1068, 1},
|
||||
{2052, 1},
|
||||
{2055, 1},
|
||||
{2057, 1},
|
||||
{2058, 1},
|
||||
{2060, 1},
|
||||
{2064, 1},
|
||||
{2070, 1},
|
||||
{2073, 1},
|
||||
{2092, 1},
|
||||
{3076, 1},
|
||||
{3079, 1},
|
||||
{3081, 1},
|
||||
{3082, 1},
|
||||
{3084, 1},
|
||||
{4100, 1},
|
||||
{4103, 1},
|
||||
{4105, 1},
|
||||
{4106, 1},
|
||||
{4108, 1},
|
||||
{5124, 1},
|
||||
{5127, 1},
|
||||
{5129, 1},
|
||||
{5130, 1},
|
||||
{5132, 1},
|
||||
{6153, 1},
|
||||
{6154, 1},
|
||||
{6156, 1},
|
||||
{7177, 1},
|
||||
{7178, 1},
|
||||
{7180, 1},
|
||||
{8201, 1},
|
||||
{8202, 1},
|
||||
{8204, 1},
|
||||
{9225, 1},
|
||||
{9226, 1},
|
||||
{9228, 1},
|
||||
{10249, 1},
|
||||
{10250, 1},
|
||||
{10252, 1},
|
||||
{11273, 1},
|
||||
{11274, 1},
|
||||
{11276, 1},
|
||||
{12297, 1},
|
||||
{12298, 1},
|
||||
{12300, 1},
|
||||
{13321, 1},
|
||||
{13322, 1},
|
||||
{13324, 1},
|
||||
{14345, 1},
|
||||
{14346, 1},
|
||||
{14348, 1},
|
||||
{15369, 1},
|
||||
{15370, 1},
|
||||
{15372, 1},
|
||||
{16393, 1},
|
||||
{16394, 1},
|
||||
{17417, 1},
|
||||
{17418, 1},
|
||||
{18441, 1},
|
||||
{18442, 1},
|
||||
{19466, 1},
|
||||
{20490, 1},
|
||||
{21514, 1},
|
||||
{22538, 1},
|
||||
{23562, 1},
|
||||
{29740, 1},
|
||||
{30724, 1},
|
||||
{30764, 1},
|
||||
{31748, 1}
|
||||
};
|
||||
public static void parse()
|
||||
{
|
||||
List<int> aLcid = new List<int>();
|
||||
Dictionary<int, CultureInfo> aInfos = new Dictionary<int, CultureInfo>();
|
||||
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
|
||||
{
|
||||
if (!aInfos.ContainsKey(ci.LCID))
|
||||
if (!aInfos.ContainsKey(ci.LCID) && g_mapUsedValues.ContainsKey(ci.LCID))
|
||||
{
|
||||
aLcid.Add(ci.LCID);
|
||||
aInfos[ci.LCID] = ci;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 2.4.461.0
|
||||
VERSION = 2.4.464.0
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
TARGET = x2t
|
||||
|
||||
@ -1457,14 +1457,21 @@ namespace NExtractTools
|
||||
int mscrypt2oox (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring password = params.getPassword();
|
||||
//decrypt to sTo
|
||||
|
||||
ECMACryptFile cryptReader;
|
||||
if (cryptReader.DecryptOfficeFile(sFrom, sTo, password) == false)
|
||||
bool bDataIntegrity = false;
|
||||
|
||||
if (cryptReader.DecryptOfficeFile(sFrom, sTo, password, bDataIntegrity) == false)
|
||||
{
|
||||
if (password.empty()) return AVS_FILEUTILS_ERROR_CONVERT_DRM;
|
||||
else return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
}
|
||||
|
||||
if (bDataIntegrity == false)
|
||||
{
|
||||
//было несанкционированое вешательство в файл
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
int mscrypt2oot_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
@ -1473,9 +1480,16 @@ namespace NExtractTools
|
||||
std::wstring sResultDecryptFile = sTemp + FILE_SEPARATOR_STR + L"uncrypt_file.oox";
|
||||
|
||||
ECMACryptFile cryptReader;
|
||||
if (cryptReader.DecryptOfficeFile(sFrom, sResultDecryptFile, params.getPassword()) == false)
|
||||
bool bDataIntegrity = false;
|
||||
|
||||
if (cryptReader.DecryptOfficeFile(sFrom, sResultDecryptFile, params.getPassword(), bDataIntegrity) == false)
|
||||
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
|
||||
|
||||
if (bDataIntegrity == false)
|
||||
{
|
||||
//было несанкционированое вешательство в файл
|
||||
}
|
||||
|
||||
COfficeFileFormatChecker OfficeFileFormatChecker;
|
||||
|
||||
if (OfficeFileFormatChecker.isOfficeFile(sResultDecryptFile))
|
||||
@ -1500,6 +1514,19 @@ namespace NExtractTools
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring password = params.getPassword();
|
||||
|
||||
ECMACryptFile cryptReader;
|
||||
|
||||
if (cryptReader.EncryptOfficeFile(sFrom, sTo, password) == false)
|
||||
{
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
int fromMscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring password = params.getPassword();
|
||||
@ -1556,7 +1583,7 @@ namespace NExtractTools
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
//html
|
||||
//html
|
||||
int html2doct_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
std::vector<std::wstring> arFiles;
|
||||
@ -1908,7 +1935,19 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo)
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
if(params.hasPassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.docx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC == nFormatTo)
|
||||
{
|
||||
@ -2077,7 +2116,19 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
if(params.hasPassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
@ -2219,7 +2270,19 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
if(params.hasPassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP == nFormatTo)
|
||||
@ -2494,7 +2557,54 @@ namespace NExtractTools
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
int html2doct_bin(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring sResultDoctDir = NSFile::GetDirectoryName(sTo);
|
||||
|
||||
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
|
||||
|
||||
return nRes;
|
||||
}
|
||||
int html2doct(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
||||
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||
|
||||
NSDirectory::CreateDirectory(sResultDoctDir);
|
||||
|
||||
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
|
||||
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDoctDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
int html2docx(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
|
||||
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||
|
||||
NSDirectory::CreateDirectory(sResultDoctDir);
|
||||
|
||||
int nRes = html2doct_dir(sFrom, sResultDoctDir, sTemp, params);
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
|
||||
NSDirectory::CreateDirectory(sDocxDir);
|
||||
|
||||
nRes = doct_bin2docx_dir(sResultDoctFileEditor, L"", sDocxDir, false, L"", params);
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sDocxDir, sTo)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
int fromInputParams(InputParams& oInputParams)
|
||||
{
|
||||
TConversionDirection conversion = oInputParams.getConversionDirection();
|
||||
@ -2801,6 +2911,26 @@ namespace NExtractTools
|
||||
result = mscrypt2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
{
|
||||
}break;
|
||||
case TCD_HTML2DOCX:
|
||||
{
|
||||
result = html2docx (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
case TCD_HTML2DOCT:
|
||||
{
|
||||
result = html2doct (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
case TCD_HTML2DOCT_BIN:
|
||||
{
|
||||
result = html2doct_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
|
||||
//TCD_FB22DOCX,
|
||||
//TCD_FB22DOCT,
|
||||
//TCD_FB22DOCT_BIN,
|
||||
|
||||
//TCD_EPUB2DOCX,
|
||||
//TCD_EPUB2DOCT,
|
||||
//TCD_EPUB2DOCT_BIN,
|
||||
}
|
||||
|
||||
// delete temp dir
|
||||
|
||||
@ -128,6 +128,12 @@ namespace NExtractTools
|
||||
int mscrypt2oox (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
int mscrypt2oot (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
int mscrypt2oot_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
|
||||
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
|
||||
int html2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
int html2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
int html2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
int dir2zip (const std::wstring &sFrom, const std::wstring &sTo);
|
||||
|
||||
@ -223,6 +223,24 @@ namespace NExtractTools
|
||||
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_MSCRYPT2PPTT;
|
||||
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_MSCRYPT2BIN;
|
||||
}break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML:
|
||||
{
|
||||
if (0 == sExt2.compare(_T(".docx"))) res = TCD_HTML2DOCX;
|
||||
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_HTML2DOCT;
|
||||
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_HTML2DOCT_BIN;
|
||||
}break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2:
|
||||
{
|
||||
if (0 == sExt2.compare(_T(".docx"))) res = TCD_FB22DOCX;
|
||||
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_FB22DOCT;
|
||||
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_FB22DOCT_BIN;
|
||||
}break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB:
|
||||
{
|
||||
if (0 == sExt2.compare(_T(".docx"))) res = TCD_EPUB2DOCX;
|
||||
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_EPUB2DOCT;
|
||||
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_EPUB2DOCT_BIN;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ namespace NExtractTools
|
||||
TCD_PPTT2ODP,
|
||||
TCD_PPTX_BIN2ODP,
|
||||
|
||||
TCD_XML2DOCX,
|
||||
TCD_XML2DOCX,
|
||||
TCD_DOCX2XML,
|
||||
//
|
||||
TCD_MSCRYPT2,
|
||||
@ -145,6 +145,18 @@ namespace NExtractTools
|
||||
TCD_MSCRYPT2PPTT,
|
||||
TCD_MSCRYPT2BIN,
|
||||
//
|
||||
TCD_HTML2DOCX,
|
||||
TCD_HTML2DOCT,
|
||||
TCD_HTML2DOCT_BIN,
|
||||
|
||||
TCD_FB22DOCX,
|
||||
TCD_FB22DOCT,
|
||||
TCD_FB22DOCT_BIN,
|
||||
|
||||
TCD_EPUB2DOCX,
|
||||
TCD_EPUB2DOCT,
|
||||
TCD_EPUB2DOCT_BIN,
|
||||
|
||||
TCD_MAILMERGE,
|
||||
TCD_T2,
|
||||
TCD_DOCT_BIN2,
|
||||
@ -499,6 +511,10 @@ namespace NExtractTools
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool hasPassword() const
|
||||
{
|
||||
return NULL != m_sPassword;
|
||||
}
|
||||
std::wstring getPassword() const
|
||||
{
|
||||
return (NULL != m_sPassword) ? (*m_sPassword) : L"";
|
||||
@ -544,7 +560,7 @@ namespace NExtractTools
|
||||
}
|
||||
sRes = L"<xmlOptions><fileOptions fileType='" + std::to_wstring(nFileType);
|
||||
sRes += L"' codePage='" + std::to_wstring(nCsvEncoding);
|
||||
sRes += L"' delimiter='" + XmlUtils::EncodeXmlString(cDelimiter) + L"' " + sSaveType;
|
||||
sRes += L"' delimiter='" + XmlUtils::EncodeXmlStringExtend(cDelimiter) + L"' " + sSaveType;
|
||||
sRes += L"/><TXTOptions><Encoding>" + std::to_wstring(nCsvEncoding) + L"</Encoding></TXTOptions></xmlOptions>";
|
||||
|
||||
return sRes;
|
||||
|
||||
@ -187,7 +187,8 @@ namespace BinXlsxRW
|
||||
ExternalReferences = 5,
|
||||
ExternalReference = 6,
|
||||
PivotCaches = 7,
|
||||
PivotCache = 8
|
||||
PivotCache = 8,
|
||||
ExternalBook = 9
|
||||
};}
|
||||
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
|
||||
{
|
||||
@ -819,6 +820,27 @@ namespace BinXlsxRW
|
||||
cacheId = 3,
|
||||
table = 4
|
||||
};}
|
||||
namespace c_oSer_ExternalLinkTypes{enum c_oSer_ExternalLinkTypes
|
||||
{
|
||||
Id = 0,
|
||||
SheetNames = 1,
|
||||
SheetName = 2,
|
||||
DefinedNames = 3,
|
||||
DefinedName = 4,
|
||||
DefinedNameName = 5,
|
||||
DefinedNameRefersTo = 6,
|
||||
DefinedNameSheetId = 7,
|
||||
SheetDataSet = 8,
|
||||
SheetData = 9,
|
||||
SheetDataSheetId = 10,
|
||||
SheetDataRefreshError = 11,
|
||||
SheetDataRow = 12,
|
||||
SheetDataRowR = 13,
|
||||
SheetDataRowCell = 14,
|
||||
SheetDataRowCellRef = 15,
|
||||
SheetDataRowCellType = 16,
|
||||
SheetDataRowCellValue = 17
|
||||
};}
|
||||
}
|
||||
|
||||
#endif //
|
||||
|
||||
@ -1583,13 +1583,13 @@ namespace BinXlsxRW
|
||||
if(pExternalReference->m_oRid.IsInit())
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = workbook.Find( OOX::RId(pExternalReference->m_oRid->GetValue()));
|
||||
|
||||
|
||||
if (pFile.IsInit() && OOX::Spreadsheet::FileTypes::ExternalLinks == pFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CExternalLink* pExternalLink = static_cast<OOX::Spreadsheet::CExternalLink*>(pFile.operator ->());
|
||||
if ((pExternalLink) && (pExternalLink->m_oExternalBook.IsInit()))
|
||||
{
|
||||
std::wstring sLink;
|
||||
std::wstring sLink;
|
||||
if (pExternalLink->m_oExternalBook->m_oRid.IsInit())
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pExternalLink->Find( OOX::RId(pExternalLink->m_oExternalBook->m_oRid.get().GetValue()));
|
||||
@ -1597,12 +1597,12 @@ namespace BinXlsxRW
|
||||
{
|
||||
OOX::Spreadsheet::ExternalLinkPath* pLinkFile = static_cast<OOX::Spreadsheet::ExternalLinkPath*>(pFile.operator ->());
|
||||
sLink = pLinkFile->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!sLink.empty())
|
||||
if(!sLink.empty())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::ExternalReference);
|
||||
m_oBcw.m_oStream.WriteStringW3(sLink);
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::ExternalBook);
|
||||
WriteExternalBook(pExternalLink->m_oExternalBook.get(), sLink);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
@ -1610,7 +1610,144 @@ namespace BinXlsxRW
|
||||
}
|
||||
}
|
||||
};
|
||||
void WriteExternalBook(const OOX::Spreadsheet::CExternalBook& externalBook, const std::wstring& sLink)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::Id);
|
||||
m_oBcw.m_oStream.WriteStringW3(sLink);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
|
||||
if (externalBook.m_oSheetNames.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetNames);
|
||||
WriteExternalSheetNames(externalBook.m_oSheetNames.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (externalBook.m_oDefinedNames.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::DefinedNames);
|
||||
WriteExternalDefinedNames(externalBook.m_oDefinedNames.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (externalBook.m_oSheetDataSet.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataSet);
|
||||
WriteExternalSheetDataSet(externalBook.m_oSheetDataSet.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalSheetNames(const OOX::Spreadsheet::CExternalSheetNames& sheetNames)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for (size_t i = 0, length = sheetNames.m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetName);
|
||||
m_oBcw.m_oStream.WriteStringW3(sheetNames.m_arrItems[i]->ToString2());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalDefinedNames(const OOX::Spreadsheet::CExternalDefinedNames& definedNames)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for (size_t i = 0, length = definedNames.m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::DefinedName);
|
||||
WriteExternalDefinedName(*definedNames.m_arrItems[i]);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalDefinedName(const OOX::Spreadsheet::CExternalDefinedName& definedName)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (definedName.m_oName.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::DefinedNameName);
|
||||
m_oBcw.m_oStream.WriteStringW3(definedName.m_oName.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (definedName.m_oRefersTo.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::DefinedNameRefersTo);
|
||||
m_oBcw.m_oStream.WriteStringW3(definedName.m_oRefersTo.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (definedName.m_oSheetId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::DefinedNameSheetId);
|
||||
m_oBcw.m_oStream.WriteULONG(definedName.m_oSheetId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalSheetDataSet(const OOX::Spreadsheet::CExternalSheetDataSet& sheetDataSet)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for (size_t i = 0, length = sheetDataSet.m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetData);
|
||||
WriteExternalSheetData(*sheetDataSet.m_arrItems[i]);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalSheetData(const OOX::Spreadsheet::CExternalSheetData& sheetData)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(sheetData.m_oSheetId.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataSheetId);
|
||||
m_oBcw.m_oStream.WriteULONG(sheetData.m_oSheetId->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(sheetData.m_oRefreshError.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRefreshError);
|
||||
m_oBcw.m_oStream.WriteBOOL(sheetData.m_oRefreshError->ToBool());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for (size_t i = 0, length = sheetData.m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRow);
|
||||
WriteExternalRow(*sheetData.m_arrItems[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalRow(const OOX::Spreadsheet::CExternalRow& row)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(row.m_oR.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRowR);
|
||||
m_oBcw.m_oStream.WriteULONG(row.m_oR->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for (size_t i = 0, length = row.m_arrItems.size(); i < length; ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRowCell);
|
||||
WriteExternalCell(*row.m_arrItems[i]);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteExternalCell(const OOX::Spreadsheet::CExternalCell& cell)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(cell.m_oRef.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRowCellRef);
|
||||
m_oBcw.m_oStream.WriteStringW3(cell.m_oRef.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(cell.m_oType.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRowCellType);
|
||||
m_oBcw.m_oStream.WriteBYTE(cell.m_oType->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(cell.m_oValue.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_ExternalLinkTypes::SheetDataRowCellValue);
|
||||
m_oBcw.m_oStream.WriteStringW3(cell.m_oValue->ToString());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void WriteDefinedName(const OOX::Spreadsheet::CDefinedName& definedName)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
@ -2686,10 +2823,11 @@ namespace BinXlsxRW
|
||||
|
||||
if (olePic->oleObject->m_OleObjectFile.IsInit())
|
||||
{
|
||||
//if (olePic->oleObject->m_OleObjectFile->isMsPackage() == false)
|
||||
olePic->blipFill.blip->oleFilepathBin = olePic->oleObject->m_OleObjectFile->filename().GetPath();
|
||||
}
|
||||
}
|
||||
OOX::Image* pImageFileCache = NULL;
|
||||
std::wstring sIdImageFileCache;
|
||||
if ((NULL != pShapeElem) && (OOX::et_v_shapetype != pShapeElem->getType()))
|
||||
{
|
||||
OOX::Vml::CShape* pShape = static_cast<OOX::Vml::CShape*>(pShapeElem);
|
||||
@ -2704,26 +2842,43 @@ namespace BinXlsxRW
|
||||
if(OOX::et_v_imagedata == pChildElemShape->getType())
|
||||
{
|
||||
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
|
||||
|
||||
if (pImageData->m_oRelId.IsInit())
|
||||
|
||||
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
|
||||
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
|
||||
|
||||
if (!sIdImageFileCache.empty())
|
||||
{
|
||||
olePic->blipFill.blip->embed = new OOX::RId(pImageData->m_oRelId->GetValue());
|
||||
//ищем физический файл ( rId относительно vml_drawing)
|
||||
smart_ptr<OOX::File> pFile = pVmlDrawing->Find(olePic->blipFill.blip->embed.get());
|
||||
//ищем физический файл ( rId относительно vml_drawing)
|
||||
smart_ptr<OOX::File> pFile = pVmlDrawing->Find(sIdImageFileCache);
|
||||
|
||||
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
|
||||
{
|
||||
OOX::Image* pImageFile = static_cast<OOX::Image*>(pFile.operator->());
|
||||
|
||||
OOX::CPath pathImage = pImageFile->filename();
|
||||
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage);
|
||||
olePic->blipFill.blip->oleFilepathImage = pImageFile->filename().GetPath();
|
||||
pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pImageFileCache == NULL && pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit())
|
||||
{
|
||||
sIdImageFileCache = pOleObject->m_oObjectPr->m_oRid->GetValue();
|
||||
|
||||
smart_ptr<OOX::File> pFile = oWorksheet.Find(sIdImageFileCache);
|
||||
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
|
||||
{
|
||||
pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
|
||||
}
|
||||
}
|
||||
if (pImageFileCache)
|
||||
{
|
||||
OOX::CPath pathImage = pImageFileCache->filename();
|
||||
|
||||
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage);
|
||||
|
||||
olePic->blipFill.blip->embed = new OOX::RId(sIdImageFileCache); //ваще то тут не важно что - приоритет у того что ниже..
|
||||
olePic->blipFill.blip->oleFilepathImage = pathImage.GetPath();
|
||||
}
|
||||
|
||||
pCellAnchor->m_oElement = new PPTX::Logic::SpTreeElem();
|
||||
pCellAnchor->m_oElement->InitElem(olePic);
|
||||
|
||||
@ -1592,34 +1592,27 @@ namespace BinXlsxRW {
|
||||
int ReadExternalReferences(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSerWorkbookTypes::ExternalReference == type)
|
||||
if(c_oSerWorkbookTypes::ExternalBook == type)
|
||||
{
|
||||
std::wstring sName(m_oBufferedStream.GetString3(length));
|
||||
|
||||
if (sName.empty() == false)
|
||||
OOX::Spreadsheet::CExternalLink *extLink = new OOX::Spreadsheet::CExternalLink();
|
||||
extLink->m_oExternalBook.Init();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalBook, this, extLink);
|
||||
if (extLink->m_oExternalBook->m_oRid.IsInit())
|
||||
{
|
||||
OOX::Spreadsheet::CExternalReference* pExternalReference = new OOX::Spreadsheet::CExternalReference();
|
||||
|
||||
OOX::Spreadsheet::CExternalLink *extLink= new OOX::Spreadsheet::CExternalLink();
|
||||
smart_ptr<OOX::File> oCurFile(extLink);
|
||||
|
||||
const OOX::RId oRId = m_oWorkbook.Add(oCurFile);
|
||||
|
||||
pExternalReference->m_oRid.Init();
|
||||
pExternalReference->m_oRid->SetValue(oRId.get());
|
||||
|
||||
extLink->m_oExternalBook.Init();
|
||||
smart_ptr<OOX::File> oCurFile(extLink);
|
||||
const OOX::RId oRId = m_oWorkbook.Add(oCurFile);
|
||||
|
||||
OOX::Spreadsheet::ExternalLinkPath *link = new OOX::Spreadsheet::ExternalLinkPath(sName);
|
||||
smart_ptr<OOX::File> oLinkFile(link);
|
||||
const OOX::RId oRIdLink = extLink->Add(oLinkFile);
|
||||
|
||||
extLink->m_oExternalBook->m_oRid.Init();
|
||||
extLink->m_oExternalBook->m_oRid->SetValue(oRIdLink.get());
|
||||
pExternalReference->m_oRid.Init();
|
||||
pExternalReference->m_oRid->SetValue(oRId.get());
|
||||
|
||||
|
||||
m_oWorkbook.m_oExternalReferences->m_arrItems.push_back(pExternalReference);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEOBJECT(extLink)
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1672,6 +1665,174 @@ namespace BinXlsxRW {
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalBook(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalLink* extLink = static_cast<OOX::Spreadsheet::CExternalLink*>(poResult);
|
||||
OOX::Spreadsheet::CExternalBook* pExternalBook = extLink->m_oExternalBook.GetPointer();
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::Id == type)
|
||||
{
|
||||
std::wstring sName(m_oBufferedStream.GetString3(length));
|
||||
|
||||
OOX::Spreadsheet::ExternalLinkPath *link = new OOX::Spreadsheet::ExternalLinkPath(sName);
|
||||
smart_ptr<OOX::File> oLinkFile(link);
|
||||
const OOX::RId oRIdLink = extLink->Add(oLinkFile);
|
||||
|
||||
pExternalBook->m_oRid.Init();
|
||||
pExternalBook->m_oRid->SetValue(oRIdLink.get());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetNames == type)
|
||||
{
|
||||
pExternalBook->m_oSheetNames.Init();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalSheetNames, this, pExternalBook->m_oSheetNames.GetPointer());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::DefinedNames == type)
|
||||
{
|
||||
pExternalBook->m_oDefinedNames.Init();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalDefinedNames, this, pExternalBook->m_oDefinedNames.GetPointer());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataSet == type)
|
||||
{
|
||||
pExternalBook->m_oSheetDataSet.Init();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalSheetDataSet, this, pExternalBook->m_oSheetDataSet.GetPointer());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalSheetNames(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalSheetNames* pSheetNames = static_cast<OOX::Spreadsheet::CExternalSheetNames*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::SheetName == type)
|
||||
{
|
||||
ComplexTypes::Spreadsheet::String* pSheetName = new ComplexTypes::Spreadsheet::String();
|
||||
pSheetName->m_sVal.Init();
|
||||
pSheetName->m_sVal->append(m_oBufferedStream.GetString4(length));
|
||||
pSheetNames->m_arrItems.push_back(pSheetName);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalDefinedNames(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalDefinedNames* pDefinedNames = static_cast<OOX::Spreadsheet::CExternalDefinedNames*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::DefinedName == type)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalDefinedName* pDefinedName = new OOX::Spreadsheet::CExternalDefinedName();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalDefinedName, this, pDefinedName);
|
||||
pDefinedNames->m_arrItems.push_back(pDefinedName);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalDefinedName(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalDefinedName* pDefinedName = static_cast<OOX::Spreadsheet::CExternalDefinedName*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::DefinedNameName == type)
|
||||
{
|
||||
pDefinedName->m_oName.Init();
|
||||
pDefinedName->m_oName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::DefinedNameRefersTo == type)
|
||||
{
|
||||
pDefinedName->m_oRefersTo.Init();
|
||||
pDefinedName->m_oRefersTo->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::DefinedNameSheetId == type)
|
||||
{
|
||||
pDefinedName->m_oSheetId.Init();
|
||||
pDefinedName->m_oSheetId->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalSheetDataSet(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalSheetDataSet* pSheetDataSet = static_cast<OOX::Spreadsheet::CExternalSheetDataSet*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::SheetData == type)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalSheetData* pSheetData = new OOX::Spreadsheet::CExternalSheetData();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalSheetData, this, pSheetData);
|
||||
pSheetDataSet->m_arrItems.push_back(pSheetData);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalSheetData(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalSheetData* pSheetData = static_cast<OOX::Spreadsheet::CExternalSheetData*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::SheetDataSheetId == type)
|
||||
{
|
||||
pSheetData->m_oSheetId.Init();
|
||||
pSheetData->m_oSheetId->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataRefreshError == type)
|
||||
{
|
||||
pSheetData->m_oRefreshError.Init();
|
||||
pSheetData->m_oRefreshError->FromBool(m_oBufferedStream.GetBool());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataRow == type)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalRow* pRow = new OOX::Spreadsheet::CExternalRow();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalRow, this, pRow);
|
||||
pSheetData->m_arrItems.push_back(pRow);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalRow(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalRow* pRow = static_cast<OOX::Spreadsheet::CExternalRow*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::SheetDataRowR == type)
|
||||
{
|
||||
pRow->m_oR.Init();
|
||||
pRow->m_oR->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataRowCell == type)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalCell* pCell = new OOX::Spreadsheet::CExternalCell();
|
||||
res = Read1(length, &BinaryWorkbookTableReader::ReadExternalCell, this, pCell);
|
||||
pRow->m_arrItems.push_back(pCell);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
int ReadExternalCell(BYTE type, long length, void* poResult)
|
||||
{
|
||||
OOX::Spreadsheet::CExternalCell* pCell = static_cast<OOX::Spreadsheet::CExternalCell*>(poResult);
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if(c_oSer_ExternalLinkTypes::SheetDataRowCellRef == type)
|
||||
{
|
||||
pCell->m_oRef.Init();
|
||||
pCell->m_oRef->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataRowCellType == type)
|
||||
{
|
||||
pCell->m_oType.Init();
|
||||
pCell->m_oType->SetValue((SimpleTypes::Spreadsheet::ECellTypeType)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if(c_oSer_ExternalLinkTypes::SheetDataRowCellValue == type)
|
||||
{
|
||||
pCell->m_oValue.Init();
|
||||
pCell->m_oValue->m_sText.append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
};
|
||||
|
||||
int ReadPivotCaches(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
@ -2766,7 +2927,7 @@ namespace BinXlsxRW {
|
||||
res = Read1(length, &BinaryWorksheetsTableReader::ReadDrawing, this, pCellAnchor);
|
||||
|
||||
pCellAnchor->m_bShapeOle = false;
|
||||
if (pCellAnchor->m_oElement->is<PPTX::Logic::Pic>())
|
||||
if (pCellAnchor->m_oElement.is_init() && pCellAnchor->m_oElement->is<PPTX::Logic::Pic>())
|
||||
{
|
||||
PPTX::Logic::Pic& oPic = pCellAnchor->m_oElement->as<PPTX::Logic::Pic>();
|
||||
if(oPic.oleObject.IsInit() && oPic.oleObject->m_OleObjectFile.IsInit())
|
||||
@ -2825,24 +2986,29 @@ namespace BinXlsxRW {
|
||||
m_pCurVmlDrawing->m_lObjectIdVML = oWriter.m_lObjectIdVML;
|
||||
|
||||
pOleObject->m_oShapeId = *oPic.oleObject->m_sShapeId;
|
||||
//add image rels to VmlDrawing
|
||||
OOX::CPath pathImageCache = pOleObject->m_OleObjectFile->filename_cache();
|
||||
|
||||
NSCommon::smart_ptr<OOX::Image> pImageFileVml(new OOX::Image(false));
|
||||
pImageFileVml->set_filename(pathImageCache);
|
||||
|
||||
OOX::CPath pathImageCache = pOleObject->m_OleObjectFile->filename_cache();
|
||||
smart_ptr<OOX::RId> oRIdImg;
|
||||
|
||||
smart_ptr<OOX::File> pFileVml = pImageFileVml.smart_dynamic_cast<OOX::File>();
|
||||
m_pCurVmlDrawing->Add(*oPic.blipFill.blip->embed, pFileVml);
|
||||
if (pathImageCache.GetPath().empty() == false)
|
||||
{
|
||||
//add image rels to VmlDrawing
|
||||
NSCommon::smart_ptr<OOX::Image> pImageFileVml(new OOX::Image(false));
|
||||
pImageFileVml->set_filename(pathImageCache);
|
||||
|
||||
smart_ptr<OOX::File> pFileVml = pImageFileVml.smart_dynamic_cast<OOX::File>();
|
||||
m_pCurVmlDrawing->Add(*oPic.blipFill.blip->embed, pFileVml);
|
||||
|
||||
//add image rels to Worksheet
|
||||
NSCommon::smart_ptr<OOX::Image> pImageFileWorksheet(new OOX::Image(false));
|
||||
|
||||
//add image rels to Worksheet
|
||||
NSCommon::smart_ptr<OOX::Image> pImageFileWorksheet(new OOX::Image(false));
|
||||
|
||||
pImageFileWorksheet->set_filename(pathImageCache);
|
||||
|
||||
smart_ptr<OOX::File> pFileWorksheet = pImageFileWorksheet.smart_dynamic_cast<OOX::File>();
|
||||
const OOX::RId oRIdImg = m_pCurWorksheet->Add(pFileWorksheet);
|
||||
|
||||
//add oleObject rels
|
||||
pImageFileWorksheet->set_filename(pathImageCache);
|
||||
|
||||
smart_ptr<OOX::File> pFileWorksheet = pImageFileWorksheet.smart_dynamic_cast<OOX::File>();
|
||||
|
||||
oRIdImg = new OOX::RId(m_pCurWorksheet->Add(pFileWorksheet));
|
||||
}
|
||||
//add oleObject rels
|
||||
if(!m_pCurWorksheet->m_oOleObjects.IsInit())
|
||||
{
|
||||
m_pCurWorksheet->m_oOleObjects.Init();
|
||||
@ -2861,7 +3027,10 @@ namespace BinXlsxRW {
|
||||
pOleObject->m_oObjectPr->m_oDefaultSize.Init();
|
||||
pOleObject->m_oObjectPr->m_oDefaultSize->FromBool(false);
|
||||
pOleObject->m_oObjectPr->m_oRid.Init();
|
||||
pOleObject->m_oObjectPr->m_oRid->SetValue(oRIdImg.get());
|
||||
|
||||
if (oRIdImg.IsInit())
|
||||
pOleObject->m_oObjectPr->m_oRid->SetValue(oRIdImg->get());
|
||||
|
||||
pOleObject->m_oObjectPr->m_oAnchor.Init();
|
||||
|
||||
SimpleTypes::Spreadsheet::ECellAnchorType eAnchorType = pCellAnchor->m_oAnchorType.GetValue();
|
||||
|
||||
Reference in New Issue
Block a user