Compare commits

..

25 Commits

Author SHA1 Message Date
9b5fbdfa96 fix bug #59332 2022-10-17 18:39:01 +03:00
55f026bac4 Fix bug 59404 2022-10-17 16:04:22 +03:00
63b2ddfff3 fix build 2022-10-15 08:42:26 +03:00
0cad3436fd Merge pull request #1045 from ONLYOFFICE/fix/bug59199
Fix bug #59199
2022-10-14 12:53:10 +03:00
8aa54ed2e2 fix bug #59357 2022-10-14 12:48:47 +03:00
efb1511c59 Merge pull request #1048 from ONLYOFFICE/hotfix/v7.2.1-ppt
Hotfix/v7.2.1 ppt
2022-10-14 12:46:27 +03:00
34e9d98bee fix 59277 59281 59261 2022-10-14 12:08:05 +03:00
b25c3d3022 Switch to openssl 1.1.1i on android 2022-10-14 10:48:00 +03:00
2de73e8c02 fix part of 59276 2022-10-13 20:48:10 +03:00
fb04ac8a69 fiix bug #59353 2022-10-13 16:14:35 +03:00
a4b767303d small fixes. Audio inside animation problem 2022-10-12 18:55:09 +03:00
4b86a6384b fix bug #59329 2022-10-12 12:47:45 +03:00
889721fd7e fix part of 59276. correct tmAbs 2022-10-12 00:23:54 +03:00
1df71c6504 fix part of 59276. Added new animation 2022-10-11 14:35:59 +03:00
f354046cc5 fix bug #59322 2022-10-11 11:58:31 +03:00
b27a36246d fix include paths .. 2022-10-11 09:47:22 +03:00
74615f508e Merge branch 'hotfix/v7.2.1' of https://github.com/ONLYOFFICE/core into hotfix/v7.2.1 2022-10-11 09:46:27 +03:00
204696035d fix bug #59209 2022-10-11 09:46:21 +03:00
cbd5d75532 trying to fix 59276. Old animation problem 2022-10-11 00:30:38 +03:00
26be4d9b20 Crypto module 2022-10-10 18:40:58 +03:00
6c146707f0 [mobile] Add structure of page scroll info 2022-10-07 19:44:19 +03:00
cd0c129afb fix bug #59261 2022-10-07 14:32:06 +03:00
083304c9a3 Fix bug #58901
Implement save text field formats to PDF
2022-10-04 00:06:05 +03:00
d322c08d98 Added temporary file deletion 2022-09-30 17:52:15 +03:00
e175b310f5 Fix bug #59199 2022-09-30 17:43:11 +03:00
44 changed files with 683 additions and 291 deletions

View File

@ -225,8 +225,11 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_NODE(L"sheetData")
{
impl_->sheetData_.flush();
CP_XML_STREAM() << impl_->sheetData_.rdbuf();
if (impl_->sheetData_.rdbuf()->in_avail() != 0)
{
impl_->sheetData_.flush();
CP_XML_STREAM() << impl_->sheetData_.rdbuf();
}
}
std::wstring protect = impl_->protection_.str();
if (false == protect.empty())

View File

@ -2064,6 +2064,11 @@ void variable_get::docx_convert(oox::docx_conversion_context & Context)
const wchar_t * variable_set::ns = L"text";
const wchar_t * variable_set::name = L"variable-set";
void variable_set::add_text(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text);
content_.push_back(elm);
}
void variable_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
@ -2076,7 +2081,31 @@ void variable_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void variable_set::docx_convert(oox::docx_conversion_context & Context)
{
Context.finish_run();
Context.output_stream() << L"<w:sdt>";
Context.output_stream() << L"<w:sdtPr>";
{
Context.output_stream() << L"<w:id w:val=\"" + std::to_wstring(Context.get_drawing_context().get_current_shape_id()) + L"\"/>";
if (name_)
{
Context.output_stream() << L"<w:placeholder/>";
Context.output_stream() << L"<w:docPart w:val=\"" + xml::utils::replace_text_to_xml(*name_) + L"\"/>";
}
Context.output_stream() << L"<w:showingPlcHdr/>";
Context.output_stream() << L"<w:text/>";
}
Context.output_stream() << L"</w:sdtPr>";
Context.output_stream() << L"<w:sdtContent>";
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
}
Context.finish_run();
Context.output_stream() << L"</w:sdtContent>";
Context.output_stream() << L"</w:sdt>";
}
//---------------------------------------------------------------------------------------------------
const wchar_t * variable_decl::ns = L"text";

View File

@ -864,16 +864,18 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_text(const std::wstring & Text);
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
odf_types::common_value_and_type_attlist office_value_;
_CP_OPT(std::wstring) office_formula_;
odf_types::common_value_and_type_attlist office_value_;
_CP_OPT(std::wstring) office_formula_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) display_;
_CP_OPT(std::wstring) name_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) display_;
_CP_OPT(std::wstring) name_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(variable_set);
//---------------------------------------------------------------------------------------------------

View File

@ -201,13 +201,13 @@ namespace odf_writer
if (sz < 1)
break;
content_utf8_ += GetUtf8StringFromUnicode(Content.c_str() + pos, sz);
content_utf8_ += NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content.c_str() + pos, sz);
pos += sz;
}
}
else
content_utf8_ = GetUtf8StringFromUnicode(Content.c_str(), Content.length());
content_utf8_ = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content.c_str(), Content.length());
}else
content_utf8_ = std::string( Content.begin(), Content.end());
}
@ -226,13 +226,13 @@ namespace odf_writer
if (sz < 1)
break;
content_utf8_ += GetUtf8StringFromUnicode(Content + pos, sz);
content_utf8_ += NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content + pos, sz);
pos += sz;
}
}
else
content_utf8_ = GetUtf8StringFromUnicode(Content, Size);
content_utf8_ = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content, Size);
}
else
{
@ -605,7 +605,7 @@ namespace odf_writer
CP_XML_ATTR(L"office:version", L"1.2");
if (content_)
if ((content_) && (content_->styles_.rdbuf()->in_avail() != 0))
{
content_->styles_.flush();
CP_XML_STREAM() << content_->styles_.rdbuf();
@ -613,7 +613,7 @@ namespace odf_writer
}
CP_XML_NODE(L"office:body")
{
if (content_)
if ((content_) && (content_->content_.rdbuf()->in_avail() != 0))
{
content_->content_.flush();
CP_XML_STREAM() << content_->content_.rdbuf();
@ -675,7 +675,7 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
if (content_)
if ((content_) && (content_->content().rdbuf()->in_avail() != 0))
{
content_->content().flush();
CP_XML_STREAM() << content_->content().rdbuf();
@ -701,7 +701,7 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:xlink", L"http://www.w3.org/1999/xlink" );
CP_XML_ATTR(L"xmlns:office", L"urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
if (content_)
if ((content_) && (content_->content().rdbuf()->in_avail() != 0))
{
content_->content().flush();
CP_XML_STREAM() << content_->content().rdbuf();

View File

@ -294,10 +294,10 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
}
text_p* p = dynamic_cast<text_p*>(elm.get());
if (p) p->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
if (p) p->paragraph_attrs_.text_style_name_ = style_name;
text_h* h = dynamic_cast<text_h*>(elm.get());
if (h) h->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
if (h) h->paragraph_attrs_.text_style_name_ = style_name;
style *style_ = dynamic_cast<style*>(style_elm.get());
if (style_)
@ -310,10 +310,10 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
else if (false == parent_paragraph_style_.empty())
{
text_p* p = dynamic_cast<text_p*>(elm.get());
if (p)p->paragraph_.paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
if (p)p->paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
text_h* h = dynamic_cast<text_h*>(elm.get());
if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
if (h)p->paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
}
if (paragraph_properties_ && need_break_)
{
@ -643,12 +643,12 @@ void odf_text_context::add_text_style(office_element_ptr & style_elm, std::wstri
if (text_p* p = dynamic_cast<text_p*>(current_level_.back().elm.get()))
{
p->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
p->paragraph_attrs_.text_style_name_ = style_name;
}
if (text_h* h = dynamic_cast<text_h*>(current_level_.back().elm.get()))
{
h->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
h->paragraph_attrs_.text_style_name_ = style_name;
}
}
@ -709,8 +709,8 @@ void odf_text_context::save_property_break()
current_level_[i].style_elm = style_->get_office_element();
current_level_[i].style_name = style_->get_name();
if (p) p->paragraph_.paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
if (h) h->paragraph_.paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
if (p) p->paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
if (h) h->paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
}
break;
}

View File

@ -424,7 +424,7 @@ void ods_table_context::set_data_validation_error(const std::wstring &title, con
text_p *p = dynamic_cast<text_p*>(error_message->content_.back().get());
if (p)
{
p->paragraph_.add_text(content);
p->add_text(content);
}
}
}
@ -452,7 +452,7 @@ void ods_table_context::set_data_validation_promt(const std::wstring &title, con
text_p *p = dynamic_cast<text_p*>(help_message->content_.back().get());
if (p)
{
p->paragraph_.add_text(content);
p->add_text(content);
}
}
}

View File

@ -564,24 +564,6 @@ void table_columns_and_groups::serialize(std::wostream & strm)
content_[i]->serialize(strm);
}
}
// table-table-cell-content
//////////////////////////////////////////////////////////////////////////////////////////////////
void table_table_cell_content::create_child_element( const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
CP_CREATE_ELEMENT_SIMPLE(text_content_);
}
void table_table_cell_content::add_child_element( const office_element_ptr & child_element)
{
text_content_.push_back(child_element);
}
void table_table_cell_content::serialize(std::wostream & strm)
{
for (size_t i = 0; i < text_content_.size(); i++)
{
text_content_[i]->serialize(strm);
}
}
// table:table-cell
// table-table-cell
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -590,12 +572,11 @@ const wchar_t * table_table_cell::name = L"table-cell";
void table_table_cell::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
content_.create_child_element(Ns, Name, getContext());
CP_CREATE_ELEMENT(content_);
}
void table_table_cell::add_child_element( const office_element_ptr & child_element)
{
content_.add_child_element(child_element);
content_.push_back(child_element);
}
void table_table_cell::serialize(std::wostream & _Wostream)
{
@ -606,7 +587,10 @@ void table_table_cell::serialize(std::wostream & _Wostream)
attlist_.serialize(CP_GET_XML_NODE());
attlist_extra_.serialize(CP_GET_XML_NODE());
content_.serialize(CP_XML_STREAM());
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
@ -619,12 +603,12 @@ const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
void table_covered_table_cell::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
empty_ = false;
content_.create_child_element( Ns, Name, getContext());
CP_CREATE_ELEMENT(content_);
}
void table_covered_table_cell::add_child_element( const office_element_ptr & child_element)
{
empty_ = false;
content_.add_child_element(child_element);
content_.push_back(child_element);
}
void table_covered_table_cell::serialize(std::wostream & _Wostream)
{
@ -634,7 +618,10 @@ void table_covered_table_cell::serialize(std::wostream & _Wostream)
{
attlist_.serialize(CP_GET_XML_NODE());
content_.serialize(CP_XML_STREAM());
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}

View File

@ -405,22 +405,6 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
//-----------------------------------------------------------------------------------------------------
class table_table_cell_content
{
public:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
private:
// TODO table-cell-range-source
// TODO office-annotation
// TODO table-detective
office_element_ptr_array text_content_; // text-content
};
//-----------------------------------------------------------------------------------------------------
class table_table_cell : public office_element_impl<table_table_cell>
{
@ -430,9 +414,7 @@ public:
static const ElementType type = typeTableTableCell;
table_table_cell() { }
table_table_cell() { }
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
@ -441,10 +423,9 @@ public:
table_table_cell_attlist attlist_;
table_table_cell_attlist_extra attlist_extra_;
table_table_cell_content content_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
//-----------------------------------------------------------------------------------------------------
@ -456,8 +437,6 @@ public:
static const ElementType type = typeTableCoveredTableCell;
table_covered_table_cell() {empty_ = true; }
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
@ -467,7 +446,7 @@ public:
bool empty_;
table_table_cell_attlist attlist_;
table_table_cell_content content_;
office_element_ptr_array content_;
};

View File

@ -58,33 +58,6 @@ using xml::xml_char_wc;
const wchar_t * text_h::ns = L"text";
const wchar_t * text_h::name = L"h";
void paragraph::create_child_element( const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
{
CP_CREATE_ELEMENT_SIMPLE(paragraph_content_);
}
void paragraph::add_child_element( const office_element_ptr & child_element)
{
paragraph_content_.push_back(child_element);
}
void paragraph::add_text(const std::wstring & Text)
{
office_element_ptr elm = text_text::create(Text) ;
paragraph_content_.push_back( elm );
}
void paragraph::serialize(std::wostream & strm)
{
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(strm);
}
}
void paragraph::serialize_attr(CP_ATTR_NODE)
{
paragraph_attrs_.serialize(CP_GET_XML_NODE());
}
void paragraph_attrs::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
@ -116,24 +89,29 @@ void text_h::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT (L"text:start-value", text_start_value_);
CP_XML_ATTR (L"text:is-list-header", text_is_list_header_);
paragraph_.serialize_attr (CP_GET_XML_NODE());
paragraph_.serialize (CP_XML_STREAM());
paragraph_attrs_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//
void text_h::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
paragraph_.create_child_element(Ns, Name, getContext());
CP_CREATE_ELEMENT(paragraph_content_);
}
void text_h::add_text(const std::wstring & Text)
{
paragraph_.add_text(Text);
office_element_ptr elm = text_text::create(Text);
paragraph_content_.push_back(elm);
}
void text_h::add_child_element( const office_element_ptr & child_element)
{
paragraph_.add_child_element(child_element);
paragraph_content_.push_back(child_element);
}
// text:p
//--------------------------------------------------------------------------------------------------------
@ -142,15 +120,16 @@ const wchar_t * text_p::name = L"p";
void text_p::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
paragraph_.create_child_element( Ns, Name, getContext());
CP_CREATE_ELEMENT(paragraph_content_);
}
void text_p::add_child_element( const office_element_ptr & child_element)
{
paragraph_.add_child_element(child_element);
paragraph_content_.push_back(child_element);
}
void text_p::add_text(const std::wstring & Text)
{
paragraph_.add_text(Text);
office_element_ptr elm = text_text::create(Text);
paragraph_content_.push_back(elm);
}
void text_p::serialize(std::wostream & _Wostream)
@ -159,8 +138,12 @@ void text_p::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
paragraph_.serialize_attr (CP_GET_XML_NODE());
paragraph_.serialize (CP_XML_STREAM());
paragraph_attrs_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
}
}
}

View File

@ -59,29 +59,6 @@ public:
void serialize(CP_ATTR_NODE);
};
class paragraph
{
public:
paragraph() {}
public:
void add_text(const std::wstring & Text);
void create_child_element(const std::wstring & Ns, const std::wstring & Name,odf_conversion_context * context);
void add_child_element( const office_element_ptr & child_element);
void serialize (std::wostream & _Wostream);
void serialize_attr (CP_ATTR_NODE);
paragraph_attrs paragraph_attrs_;
office_element_ptr_array paragraph_content_;
};
//---------------------------------------------------------------------------------------------------
class text_h : public office_element_impl<text_h>
{
@ -101,18 +78,15 @@ public:
virtual void add_text(const std::wstring & Text);
// heading-attrs
unsigned int text_outline_level_;
bool text_restart_numbering_; // default false
_CP_OPT(unsigned int) text_start_value_;
bool text_is_list_header_; // default false
_CP_OPT(std::wstring) text_number_;
paragraph paragraph_;
paragraph_attrs paragraph_attrs_;
office_element_ptr_array paragraph_content_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_h);
//---------------------------------------------------------------------------------------------------
@ -122,8 +96,7 @@ public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeTextP;
static const ElementType type = typeTextP;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
@ -131,13 +104,13 @@ public:
virtual void serialize(std::wostream & _Wostream);
text_p(){};
paragraph paragraph_;
paragraph_attrs paragraph_attrs_;
office_element_ptr_array paragraph_content_;
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(text_p);
//---------------------------------------------------------------------------------------------------
class text_list : public office_element_impl<text_list>
{

View File

@ -52,6 +52,7 @@ void Animation::Convert(PPTX::Logic::Timing &oTiming)
{
if (m_pPPT10)
{
m_isPPT10Broken = false;
// It must be first to write some reference from ExtTimeNodeContainer
if (m_pPPT10->m_haveBuildList && !m_pPPT10->m_pBuildListContainer->n_arrRgChildRec.empty())
{
@ -66,7 +67,7 @@ void Animation::Convert(PPTX::Logic::Timing &oTiming)
FillTnLst(m_pPPT10->m_pExtTimeNodeContainer, *(oTiming.tnLst));
}
}
if (!m_arrOldAnim.empty() || m_isPPT10Broken)
if (!m_arrOldAnim.empty() && m_isPPT10Broken)
{
oTiming = PPTX::Logic::Timing();
InitTimingTags(oTiming);
@ -162,8 +163,8 @@ void Animation::FillAnim(
}
auto tavTime = animValue->m_oTimeAnimationValueAtom.m_nTime;
if (tavTime < 1000 && tavTime >= 0)
tav.tm = std::to_wstring((1000 - tavTime) * 100);
if (tavTime <= 1000 && tavTime >= 0) // todo check
tav.tm = std::to_wstring((/*1000 - */tavTime) * 100);
if (!animValue->m_VarFormula.m_Value.empty())
{
@ -424,6 +425,8 @@ void Animation::FillAudio(CRecordExtTimeNodeContainer *pETNC,
{
oAudio.cMediaNode.tgtEl.spTgt = new PPTX::Logic::SpTgt;
oAudio.cMediaNode.tgtEl.spTgt->spid = std::to_wstring(pCVEC->m_oVisualShapeAtom.m_nObjectIdRef);
// oAudio.isNarration = true;
// oAudio.cMediaNode.showWhenStopped = false;
} else
return;
FillCTn(pETNC, oAudio.cMediaNode.cTn);
@ -634,7 +637,6 @@ void Animation::FillCBhvr(
// accumulate - MUST be 0
// xfrmType - MUST be 0
if (pBhvr->m_haveStringList)
{
if (!pBhvr->m_pStringList->m_arrRgChildRec.empty())
@ -678,6 +680,46 @@ void Animation::FillCBhvr(
oBhvr.tgtEl.spTgt->txEl->end = pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nData2;
}
}
if (pBhvr->m_pPropertyList == nullptr)
return;
for (const auto prop : pBhvr->m_pPropertyList->m_arRecords)
{
if (prop == nullptr)
continue;
switch (prop->m_oHeader.RecInstance)
{
case TL_TBPID_RuntimeContext:
break;
case TL_TBPID_MotionPathEditRelative:
break;
case TL_TBPID_ColorColorModel:
break;
case TL_TBPID_ColorDirection:
break;
case TL_TBPID_Override:
{
auto override_ = new PPTX::Limit::TLOverride;
override_->set(L"childStyle");
oBhvr.override_= override_;
break;
}
case TL_TBPID_PathEditRotationAngle:
break;
case TL_TBPID_PathEditRotationX:
break;
case TL_TBPID_PathEditRotationY:
break;
case TL_TBPID_PointsTypes:
break;
case TL_TBPID_UnknownPropertyList:
default:
break;
}
}
}
void Animation::FillCBhvr(
PPTX::Logic::CBhvr &oBhvr, int dur,
@ -780,6 +822,9 @@ void Animation::FillCond(
cond.tgtEl->spTgt = new PPTX::Logic::SpTgt;
cond.tgtEl->spTgt->spid = std::to_wstring(
oldCond->m_oVisualElement.m_oVisualShapeAtom.m_nObjectIdRef);
} else if (oldCond->m_oVisualElement.m_bVisualPageAtom)
{
cond.tgtEl = new PPTX::Logic::TgtEl;
}
}
@ -873,12 +918,15 @@ void Animation::FillCTn(
if (iter->m_fIterateDirectionPropertyUsed)
oCTn.iterate->backwards = (bool)iter->m_nIterateDirection;
if (iter->m_fIterateIntervalTypePropertyUsed)
oCTn.iterate->tmPct = iter->m_nIterateInterval;
if (iter->m_fIterateIntervalPropertyUsed)
oCTn.iterate->tmAbs = std::to_wstring(iter->m_nIterateIntervalType);
int intervalType = iter->m_fIterateIntervalTypePropertyUsed ?
iter->m_nIterateIntervalType : 0;
unsigned int iterateInterval = iter->m_fIterateIntervalPropertyUsed ?
iter->m_nIterateInterval : 0;
if (intervalType)
oCTn.iterate->tmPct = iterateInterval > 1000 ? 10000 : iterateInterval * 10;
else
oCTn.iterate->tmAbs = std::to_wstring(iterateInterval);
}
@ -1437,6 +1485,9 @@ void Animation::SplitAnim(std::list<std::list<SOldAnimation*> >& arrClickPar)
for (auto& oldAnim : m_arrOldAnim)
{
if (isSpidReal(oldAnim.shapeId) == false)
continue;
if (arrClickPar.empty())
{
std::list<SOldAnimation*> clickPar;
@ -1670,6 +1721,7 @@ void Animation::FillCTnAnimation (PPTX::Logic::CTn &oCTN, SOldAnimation *pOldAn
const UINT effect = pOldAnim->anim->m_AnimationAtom.m_AnimEffect;
const UINT direct = pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection;
// Todo 4, 7. 0x11 - 0x1B
switch (effect)
{
case 0x00:
@ -1702,6 +1754,12 @@ void Animation::FillCTnAnimation (PPTX::Logic::CTn &oCTN, SOldAnimation *pOldAn
ConvertDissolveIn(oCTN.childTnLst.get2(), pOldAnim);
break;
}
case 0x06:
{
oCTN.presetID = 10;
ConvertFade(oCTN.childTnLst.get2(), pOldAnim);
break;
}
case 0x08:
{
oCTN.presetID = 14;
@ -1771,6 +1829,11 @@ void Animation::FillCTnAnimation (PPTX::Logic::CTn &oCTN, SOldAnimation *pOldAn
ConvertFlashOnce(oCTN.childTnLst.get2(), pOldAnim, presetSub);
break;
}
default:
oCTN.presetID = 1;
ConvertAppear(oCTN.childTnLst.get2(), pOldAnim);
std::wcout << "Error: Unknown old animation id: " << std::to_wstring(effect) << L"\n";
}
if (presetSub != -1)
@ -1970,6 +2033,12 @@ void Animation::ConvertDissolveIn(PPTX::Logic::ChildTnLst& oParent, SOldAnimatio
PushAnimEffect(oParent, pOldAnim, L"dissolve", L"in");
}
void Animation::ConvertFade(PPTX::Logic::ChildTnLst &oParent, SOldAnimation *pOldAnim)
{
PushSet(oParent, pOldAnim);
PushAnimEffect(oParent, pOldAnim, L"fade", L"in");
}
void Animation::ConvertFlashOnce(PPTX::Logic::ChildTnLst& oParent, SOldAnimation *pOldAnim, int& presetSub)
{
PushSet(oParent, pOldAnim);
@ -2389,14 +2458,19 @@ void Animation::PushSet(PPTX::Logic::ChildTnLst& oParent, SOldAnimation *pOldAni
bool Animation::isSpidReal(const UINT spid)
{
if (m_arrOldAnim.empty())
if (m_realShapesId.find(spid) == m_realShapesId.end())
return false;
else
return true;
for (const auto& oldAnim : m_arrOldAnim)
if (oldAnim.shapeId == spid)
return true;
// if (m_arrOldAnim.empty())
// return true;
return false;
// for (const auto& oldAnim : m_arrOldAnim)
// if (oldAnim.shapeId == spid)
// return true;
// return false;
}

View File

@ -53,6 +53,7 @@
#include "../Records/SlideProgTagsContainer.h"
#include "ImageManager.h"
#include "../Records/Animations/AnimationInfoContainer.h"
#include <unordered_set>
namespace PPT_FORMAT
{
@ -86,14 +87,16 @@ struct SValue
class Animation
{
public:
Animation(CRecordPP10SlideBinaryTagExtension *pPPT10Ext, const std::vector<SOldAnimation> &oldAnim, CExMedia* pExMedia, CRelsGenerator* pRels) :
Animation(CRecordPP10SlideBinaryTagExtension *pPPT10Ext, const std::vector<SOldAnimation> &oldAnim,
CExMedia* pExMedia, CRelsGenerator* pRels, const std::unordered_set<int>& realShapesId) :
m_pPPT10(pPPT10Ext),
m_arrOldAnim(oldAnim),
m_pExMedia(pExMedia),
m_pRels(pRels),
m_cTnId(1),
m_pBldLst(nullptr),
m_currentBldP(nullptr)
m_currentBldP(nullptr),
m_realShapesId(realShapesId)
{
}
@ -216,6 +219,7 @@ private:
void ConvertCheckerboard(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim);
void ConvertCrawlIn(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim, int& presetSub);
void ConvertDissolveIn(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim);
void ConvertFade(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim);
void ConvertFlashOnce(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim, int& presetSub);
void ConvertPeekIn(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim, int& presetSub);
void ConvertRandomBars(PPTX::Logic::ChildTnLst& oParent, SOldAnimation* pOldAnim, int& presetSub);
@ -259,9 +263,10 @@ private:
int m_cTnDeep = 0;
PPTX::Logic::BldLst *m_pBldLst; // Do not delete
PPTX::Logic::BldP *m_currentBldP;
const std::unordered_set<int> m_realShapesId;
int m_nextRID; // it needs for audio maybe video for compisation id number;
bool m_isPPT10Broken = false;
bool m_isPPT10Broken = true;
};
}

View File

@ -136,7 +136,7 @@ void PPT_FORMAT::CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo)
// core
oFile.CreateFileW(m_strTempDirectory + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("core.xml"));
if (m_xmlCore.empty())
if (m_xmlCore.empty())
m_xmlCore = NSPPTXWriterConst::g_string_core;
oFile.WriteStringUTF8(m_xmlCore);
oFile.CloseFile();
@ -1537,12 +1537,16 @@ void PPT_FORMAT::CPPTXWriter::WriteSlide(int nIndexSlide)
CGroupElement *pGroupElement = !pSlide->m_arElements.empty() ? dynamic_cast<CGroupElement *>(pSlide->m_arElements[0].get()) : NULL;
size_t start_index = 0;
std::unordered_set<int> realShapesId;
if (pGroupElement)
{
for (size_t i = 0; i < pGroupElement->m_pChildElements.size(); ++i)
{
WriteElement(oWriter, oRels, pGroupElement->m_pChildElements[i]);
auto& element = pGroupElement->m_pChildElements[i];
WriteElement(oWriter, oRels, element);
if (element)
realShapesId.insert(element->m_lID);
}
start_index = 1;
@ -1550,7 +1554,10 @@ void PPT_FORMAT::CPPTXWriter::WriteSlide(int nIndexSlide)
for (size_t i = start_index; i < pSlide->m_arElements.size(); ++i)
{
WriteElement(oWriter, oRels, pSlide->m_arElements[i]);
auto& element = pSlide->m_arElements[i];
WriteElement(oWriter, oRels, element);
if (element)
realShapesId.insert(element->m_lID);
}
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
@ -1560,7 +1567,7 @@ void PPT_FORMAT::CPPTXWriter::WriteSlide(int nIndexSlide)
WriteTransition(oWriter, pSlide->m_oSlideShow);
// TODO write new method and class for timing
WriteTiming(oWriter, oRels, nIndexSlide);
WriteTiming(oWriter, oRels, realShapesId, nIndexSlide);
oWriter.WriteString(std::wstring(L"</p:sld>"));
@ -2029,7 +2036,7 @@ void CPPTXWriter::WriteLayoutAfterTheme(CThemePtr pTheme, const int nIndexTheme,
}
void PPT_FORMAT::CPPTXWriter::WriteTiming(CStringWriter& oWriter, CRelsGenerator &oRels, int nIndexSlide)
void PPT_FORMAT::CPPTXWriter::WriteTiming(CStringWriter& oWriter, CRelsGenerator &oRels, const std::unordered_set<int>& realShapesId, int nIndexSlide)
{
PPTX::Logic::Timing oTiming;
@ -2056,10 +2063,10 @@ void PPT_FORMAT::CPPTXWriter::WriteTiming(CStringWriter& oWriter, CRelsGenerator
}
}
if (!pPP10SlideBinaryTag && arrOldAnim.empty())
if (/*!pPP10SlideBinaryTag && */arrOldAnim.empty()) // todo check condition
return;
Animation animation(pPP10SlideBinaryTag, arrOldAnim, &(m_pUserInfo->m_oExMedia), &oRels);
Animation animation(pPP10SlideBinaryTag, arrOldAnim, &(m_pUserInfo->m_oExMedia), &oRels, realShapesId);
animation.Convert(oTiming);
oWriter.WriteString(oTiming.toXML());

View File

@ -89,7 +89,7 @@ namespace PPT_FORMAT
// void WriteRelsMaster (std::wstring path, int type, )
void WriteSlide (int nIndexSlide);
void WriteNotes (int nIndexNotes);
void WriteTiming (CStringWriter& oWriter, CRelsGenerator &oRels, int nIndexSlide); // TODO write spec class for timing
void WriteTiming (CStringWriter& oWriter, CRelsGenerator &oRels, const std::unordered_set<int> &realShapesId, int nIndexSlide);
void WriteTransition (CStringWriter& oWriter, CSlideShowInfo& oSSInfo);
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);

View File

@ -482,7 +482,7 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertShadow(CShadow & shadow)
}
else
{
// needHiddenEffect = shadow.Visible;
// needHiddenEffect = shadow.Visible;
shadow_writer.WriteString(L"<a:outerShdw");
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(strDir);
@ -499,14 +499,14 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertShadow(CShadow & shadow)
shadow_writer.WriteString(L"</a:outerShdw>");
}
shadow_writer.WriteString(L"</a:effectLst>");
// if (needHiddenEffect)
// {
// std::wstring STRshadow;
// STRshadow = L"<a:extLst><a:ext uri=\"{AF507438-7753-43E0-B8FC-AC1667EBCBE1}\"><a14:hiddenEffects xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\">";
// STRshadow += shadow_writer.GetData();
// STRshadow += L"</a14:hiddenEffects></a:ext><a:ext uri=\"{53640926-AAD7-44D8-BBD7-CCE9431645EC}\"><a14:shadowObscured xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"1\"/></a:ext></a:extLst>";
// return STRshadow;
// }
// if (needHiddenEffect)
// {
// std::wstring STRshadow;
// STRshadow = L"<a:extLst><a:ext uri=\"{AF507438-7753-43E0-B8FC-AC1667EBCBE1}\"><a14:hiddenEffects xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\">";
// STRshadow += shadow_writer.GetData();
// STRshadow += L"</a14:hiddenEffects></a:ext><a:ext uri=\"{53640926-AAD7-44D8-BBD7-CCE9431645EC}\"><a14:shadowObscured xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" val=\"1\"/></a:ext></a:extLst>";
// return STRshadow;
// }
return shadow_writer.GetData();
}
@ -628,11 +628,11 @@ void PPT_FORMAT::CShapeWriter::WriteImageInfo()
bool bExternal = false;
std::wstring strRid = m_pRels->WriteAudio(pAudioElement->m_strAudioFileName, bExternal);
if ((int)pAudioElement->m_strAudioFileName.find(L".WAV") == -1 &&
(int)pAudioElement->m_strAudioFileName.find(L".wav") == -1)
m_oWriter.WriteString(L"<a:audioFile r:link=\"" + strRid + L"\"/>");
else
m_oWriter.WriteString(L"<a:wavAudioFile r:embed=\"" + strRid + L"\"/>");
// if ((int)pAudioElement->m_strAudioFileName.find(L".WAV") == -1 &&
// (int)pAudioElement->m_strAudioFileName.find(L".wav") == -1)
// m_oWriter.WriteString(L"<a:wavAudioFile r:embed=\"" + strRid + L"\"/>");
// else
m_oWriter.WriteString(L"<a:audioFile r:link=\"" + strRid + L"\"/>"); // todo for anim connection
sMediaFile = bExternal ? L"" : pAudioElement->m_strAudioFileName;
}
@ -676,7 +676,7 @@ void PPT_FORMAT::CShapeWriter::WriteGroupInfo()
if (!pGroupElement->m_sDescription.empty())
{
m_oWriter.WriteString(std::wstring(L" descr=\""));
m_oWriter.WriteStringXML(pGroupElement->m_sDescription);
m_oWriter.WriteStringXML(XmlUtils::EncodeXmlStringExtend(pGroupElement->m_sDescription));
m_oWriter.WriteString(std::wstring(L"\""));
}
m_oWriter.WriteString(std::wstring(L">"));
@ -729,7 +729,7 @@ void PPT_FORMAT::CShapeWriter::WriteTableInfo()
if (!pGroupElement->m_sDescription.empty())
{
m_oWriter.WriteString(std::wstring(L" descr=\""));
m_oWriter.WriteStringXML(pGroupElement->m_sDescription);
m_oWriter.WriteStringXML(XmlUtils::EncodeXmlStringExtend(pGroupElement->m_sDescription));
m_oWriter.WriteString(std::wstring(L"\""));
}
m_oWriter.WriteString(std::wstring(L">"));
@ -782,7 +782,7 @@ void PPT_FORMAT::CShapeWriter::WriteShapeInfo()
if (!pShapeElement->m_sDescription.empty())
{
m_oWriter.WriteString(std::wstring(L" descr=\""));
m_oWriter.WriteStringXML(pShapeElement->m_sDescription);
m_oWriter.WriteStringXML(XmlUtils::EncodeXmlStringExtend(pShapeElement->m_sDescription, true));
m_oWriter.WriteString(std::wstring(L"\""));
}
m_oWriter.WriteString(std::wstring(L">"));
@ -1556,7 +1556,7 @@ void PPT_FORMAT::CShapeWriter::WriteHyperlink(const std::vector<CInteractiveInfo
&& actions[i].m_lType == II_NoAction)
continue;
if (actions[i].m_strHyperlink.empty())
if (actions[i].m_strHyperlink.empty() && actions[i].m_lType != LT_CustomShow)
continue;
PPTX::Logic::Hyperlink hlink;

View File

@ -2401,7 +2401,11 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
oInfo.m_type = CExFilesInfo::ExFilesType::eftSlide;
m_oExMedia.m_arSlides.push_back(oInfo);
wasSlide = true;
}
} /*else if (oInfo.isHTTPLink(recStr))
{
oInfo.m_type = CExFilesInfo::ExFilesType::eftHyperlink;
m_oExMedia.m_arSlides.push_back(oInfo);
}*/
}
if (pExHyperlink->m_targetAtom.IsInit())
@ -2483,6 +2487,9 @@ void CPPTUserInfo::LoadExAudio(CRecordsContainer* pExObject)
oInfo.m_bLoop = oArrayExMedia[0]->m_bLoop;
oInfo.m_fNarration = oArrayExMedia[0]->m_bNarration;
oInfo.m_fRewind = oArrayExMedia[0]->m_bRewind;
m_oExMedia.m_arAudios.push_back(oInfo);
}

View File

@ -82,32 +82,26 @@ public:
eftAudio = 2,
eftHyperlink = 3,
eftObject = 4,
eftSlide = 5/*,
eftFile = 6*/
eftSlide = 5,
eftFile = 6
};
ExFilesType m_type;
_UINT32 m_dwID;
std::wstring m_strFilePath;
ExFilesType m_type = eftNone;
_UINT32 m_dwID = 0;
std::wstring m_strFilePath = L"";
std::wstring m_name;
// clip
double m_dStartTime;
double m_dEndTime;
double m_dStartTime = 0.0;
double m_dEndTime = 1.0;
// loop
bool m_bLoop;
bool m_bLoop = false;
bool m_fNarration = false; // isNarration pptx
bool m_fRewind = false;
CExFilesInfo()
{
m_type = eftNone;
m_dwID = 0;
m_strFilePath = _T("");
m_dStartTime = 0.0;
m_dEndTime = -1.0;
m_bLoop = false;
}
CExFilesInfo(const CExFilesInfo& oSrc)
{

View File

@ -126,7 +126,7 @@ namespace PPT_FORMAT
if (value <= 0 || value > 255)
return false;
std::set<int> BLCharset = {128, 136};
std::set<int> BLCharset = {128, 136, 129};
return BLCharset.find(value) == BLCharset.end();
}

View File

@ -251,7 +251,7 @@ std::wstring RtfAbstractReader::ExecuteTextInternalCodePage( std::string& sCharS
RtfFont oFont;
if( true == oDocument.m_oFontTable.GetFont( oReader.m_oState->m_oCharProp.m_nFont, oFont ) && !m_bUseGlobalCodepage)
{
if( PROP_DEF != oFont.m_nCharset )
if( PROP_DEF != oFont.m_nCharset && oFont.m_nCharset > 1)
{
nCodepage = RtfUtility::CharsetToCodepage( oFont.m_nCharset );
}

View File

@ -240,16 +240,16 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_NODE(L"sheetData")
{
impl_->sheetData_.flush();
CP_XML_STREAM() << impl_->sheetData_.rdbuf();
impl_->sheetData_.clear();
if (impl_->sheetData_.rdbuf()->in_avail() != 0)
{
impl_->sheetData_.flush();
CP_XML_STREAM() << impl_->sheetData_.rdbuf();
impl_->sheetData_.clear();
}
}
CP_XML_STREAM() << impl_->protection_.str();
//оказывается порядок нахождения элементов важен !!! (для office 2010)
//объединенные ячейки раньше чем гиперлинки !!!
CP_XML_STREAM() << impl_->sortAndFilters_.str();
CP_XML_STREAM() << impl_->customViews_.str();

View File

@ -37,8 +37,8 @@ echo TOOLS_ROOT=${TOOLS_ROOT}
# openssl-1.1.0f has a configure bug
# openssl-1.1.1d has fix configure bug
LIB_VERSION="OpenSSL_1_1_1d"
LIB_NAME="openssl-1.1.1d"
LIB_VERSION="OpenSSL_1_1_1i"
LIB_NAME="openssl-1.1.1i"
echo "https://www.openssl.org/source/${LIB_NAME}.tar.gz"

View File

@ -810,9 +810,7 @@ namespace ComplexTypes
{
std::wstring sResult;
sResult += L"w:val=\"";
sResult += m_oVal.ToString();
sResult += L"\" ";
sResult += L"w:val=\"" + m_oVal.ToString() + L"\" ";
return sResult;
}
@ -826,6 +824,8 @@ namespace ComplexTypes
{
if (m_oVal.ToBool())
return L"<" + node_name + L"/>";
else
return L"<" + node_name + L" w:val=\"0\"/>";
return L"";
}
public:

View File

@ -2746,6 +2746,25 @@ namespace NSEditorApi
}
};
class CAscPageScrollInfo : public IMenuEventDataBase
{
public:
int status;
int page;
int pages;
public:
CAscPageScrollInfo()
{
status = 0;
page = 0;
pages = 0;
}
virtual ~CAscPageScrollInfo()
{
}
};
class CAscStatisticInfo : public IMenuEventDataBase
{
public:

View File

@ -30,9 +30,9 @@
*
*/
#include "nativecontrol.h"
#include "../../../core/DesktopEditor/raster/ImageFileFormatChecker.h"
#include "../../../core/DesktopEditor/raster/BgraFrame.h"
#include "../../../core/Common/Network/FileTransporter/include/FileTransporter.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../Common/Network/FileTransporter/include/FileTransporter.h"
CImagesWorker::CImagesWorker(const std::wstring& sFolder)
{

View File

@ -36,7 +36,7 @@
#include <string>
#include <vector>
#include "../../../core/DesktopEditor/graphics/pro/Fonts.h"
#include "../../DesktopEditor/graphics/pro/Fonts.h"
#include "../../Common/kernel_config.h"

View File

@ -619,11 +619,12 @@ namespace Aggplus
if (!bIsUseIdentity)
{
agg::trans_affine* full_trans = &m_oFullTransform.m_internal->m_agg_mtx;
double dDet = full_trans->determinant();
if (full_trans->sx < 0.01 && full_trans->sy < 0.01)
if (fabs(dDet) < 0.0001)
{
path_copy.transform_all_paths(m_oFullTransform.m_internal->m_agg_mtx);
dWidth *= sqrt(full_trans->sx * full_trans->sy);
dWidth *= sqrt(dDet);
bIsUseIdentity = true;
}

View File

@ -333,6 +333,90 @@ public:
Never = 0x03
};
enum EFormatType
{
None = 0,
Digit = 1,
Letter = 2,
Mask = 3,
RegExp = 4
};
class CTextFormFormat
{
public:
CTextFormFormat()
{
m_eFormatType = EFormatType::None;
}
void SetType(const EFormatType& eType)
{
m_eFormatType = eType;
}
const EFormatType& GetType() const
{
return m_eFormatType;
}
void AddSymbol(const unsigned int& unCodePoint)
{
m_vSymbols.push_back(unCodePoint);
}
unsigned int GetSymbolsCount() const
{
return m_vSymbols.size();
}
unsigned int GetSymbol(const unsigned int& unIndex) const
{
if (unIndex >= m_vSymbols.size())
return 0;
return m_vSymbols.at(unIndex);
}
void SetValue(const std::wstring& wsValue)
{
m_wsValue = wsValue;
}
const std::wstring& GetValue() const
{
return m_wsValue;
}
bool IsEmpty() const
{
return (m_eFormatType == EFormatType::None && !m_vSymbols.size());
}
bool IsMask() const
{
return (m_eFormatType == EFormatType::Mask);
}
bool IsDigit() const
{
return (m_eFormatType == EFormatType::Digit);
}
bool IsLetter() const
{
return (m_eFormatType == EFormatType::Letter);
}
bool IsRegExp() const
{
return (m_eFormatType == EFormatType::RegExp);
}
const std::wstring& GetMask() const
{
return m_wsValue;
}
const std::wstring& GetRegExp() const
{
return m_wsValue;
}
private:
EFormatType m_eFormatType;
std::vector<unsigned int> m_vSymbols;
std::wstring m_wsValue; // mask or regexp
};
class CTextFormPr
{
public:
@ -391,15 +475,26 @@ public:
{
return m_wsPlaceHolder;
}
CTextFormFormat* GetFormat()
{
return &m_oFormat;
}
const CTextFormFormat* GetFormatPr() const
{
return &m_oFormat;
}
private:
std::wstring m_wsTextValue;
unsigned int m_unMaxCharacters;
bool m_bComb;
bool m_bAutoFit;
bool m_bMultiLine;
std::wstring m_wsPlaceHolder;
std::wstring m_wsTextValue;
unsigned int m_unMaxCharacters;
bool m_bComb;
bool m_bAutoFit;
bool m_bMultiLine;
std::wstring m_wsPlaceHolder;
CTextFormFormat m_oFormat;
};
class CDropDownFormPr
{

View File

@ -1117,6 +1117,20 @@ namespace NSOnlineOfficeBinToPdf
if (nFlags & (1 << 25))
pPr->SetPlaceHolder(ReadString(current, curindex));
if (nFlags & (1 << 26))
{
CFormFieldInfo::CTextFormFormat* pFormat = pPr->GetFormat();
pFormat->SetType((CFormFieldInfo::EFormatType)ReadByte(current, curindex));
unsigned int unSymbolsCount = ReadInt(current, curindex);
for (unsigned int unSymbolIndex = 0; unSymbolIndex < unSymbolsCount; ++unSymbolIndex)
{
pFormat->AddSymbol(ReadInt(current, curindex));
}
pFormat->SetValue(ReadString(current, curindex));
}
}
else if (oInfo.IsDropDownList())
{

View File

@ -841,6 +841,12 @@ namespace MetaFile
m_pRenderer->put_BrushTextureMode(c_BrushTextureModeTile);
m_pRenderer->put_BrushTexturePath(pBrush->GetDibPatterPath());
}
else if (BS_PATTERN == unBrushStyle)
{
m_pRenderer->put_BrushType(c_BrushTypePattern);
m_pRenderer->put_BrushTextureMode(c_BrushTextureModeTileCenter);
m_pRenderer->put_BrushTexturePath(pBrush->GetDibPatterPath());
}
else if (BS_HATCHED == unBrushStyle)
{
m_pRenderer->put_BrushType(c_BrushTypeHatch1);

View File

@ -507,7 +507,35 @@ namespace MetaFile
}
case BrushTypeTextureFill:
{
//TODO: реализовать
// TODO: так как на данный момент нельзя регулировать повторение заливки, то будет отрисовывать изображение при самой заливки
pEmfPlusBrush->Style = BS_PATTERN;
unsigned int unBrushDataFlags, unSkip = 16;
m_oStream >> unBrushDataFlags;
m_oStream.Skip(4); // WrapMode
if (unBrushDataFlags & BrushDataTransform)
{
m_oStream.Skip(24); // TransformMatrix
unSkip += 24;
}
if (m_ulRecordSize <= 28)
break;
m_ulRecordSize -= unSkip;
CEmfPlusImage oImage;
ReadImage(oImage);
std::wstring wsImagePath;
if (SaveImage(oImage, wsImagePath))
pEmfPlusBrush->DibPatterPath = wsImagePath;
m_ulRecordSize += unSkip;
break;
}
case BrushTypePathGradient:
@ -1264,6 +1292,36 @@ namespace MetaFile
oMatrix.Dy *= m_dUnitKoef;
}
bool CEmfPlusParser::SaveImage(const CEmfPlusImage &oEmfPlusImage, std::wstring &wsPathToImage)
{
if (ImageDataTypeBitmap != oEmfPlusImage.GetImageDataType())
return false;
BYTE* pBytes;
unsigned int unImageSize;
oEmfPlusImage.GetData(pBytes, unImageSize);
NSFile::CFileBinary oFile;
std::wstring wsTempPath = oFile.GetTempPath() + L"/Temp" + std::to_wstring(unImageSize) + L".tmp";
if (!oFile.CreateFileW(wsTempPath))
return false;
if (!oFile.WriteFile(pBytes, unImageSize))
{
oFile.CloseFile();
return false;
}
oFile.CloseFile();
wsPathToImage = wsTempPath;
return true;
}
BYTE* GetClipedImage(const BYTE* pBuffer, LONG lWidth, LONG lHeight, TRect& oNewRect)
{
if (NULL == pBuffer ||

View File

@ -84,6 +84,8 @@ namespace MetaFile
void UpdateMatrix(TEmfPlusXForm& oMatrix);
bool SaveImage(const CEmfPlusImage& oImage, std::wstring& wsPathToImage);
void Read_EMRPLUS_OFFSETCLIP();
void Read_EMRPLUS_RESETCLIP();
void Read_EMFPLUS_SETCLIPPATH(unsigned short unShFlags);

View File

@ -163,7 +163,12 @@ namespace MetaFile
{
public:
CEmfPlusBrush() : CEmfPlusObject(), Style(BS_SOLID), Hatch(0), Angle(0) {};
virtual ~CEmfPlusBrush() {};
virtual ~CEmfPlusBrush()
{
if (!DibPatterPath.empty() && NSFile::CFileBinary::Exists(DibPatterPath))
NSFile::CFileBinary::Remove(DibPatterPath);
};
virtual EEmfObjectType GetType() override
{
return EMF_OBJECT_BRUSH;
@ -211,7 +216,7 @@ namespace MetaFile
std::wstring GetDibPatterPath()
{
return std::wstring();
return DibPatterPath;
}
void GetBounds(double& left, double& top, double& width, double& height)
@ -228,6 +233,7 @@ namespace MetaFile
unsigned int Hatch;
TEmfPlusRectF RectF;
unsigned int Angle;
std::wstring DibPatterPath;
};
class CEmfPlusPen: public CEmfPlusObject, public IPen

View File

@ -35,6 +35,8 @@ namespace NSCertificate
Q_DECL_EXPORT CCertificateInfo GetInfo(ICertificate* pCert);
Q_DECL_EXPORT ICertificate* FromFiles(const std::wstring& keyPath, const std::string& keyPassword, const std::wstring& certPath, const std::string& certPassword);
Q_DECL_EXPORT ICertificate* FromFilesRaw(unsigned char* key, unsigned int keyLen, const std::string& keyPassword,
unsigned char* cert, unsigned int certLen, const std::string& certPassword);
Q_DECL_EXPORT int GetOOXMLHashAlg(const std::string& sAlg);
Q_DECL_EXPORT std::string GetDigestMethodA(const int& nAlg);

View File

@ -117,6 +117,16 @@ namespace NSCertificate
return NULL;
}
ICertificate* FromFilesRaw(unsigned char* key, unsigned int keyLen, const std::string& keyPassword,
unsigned char* cert, unsigned int certLen, const std::string& certPassword)
{
CCertificate_openssl* pCert = new CCertificate_openssl();
if (pCert->FromFilesRaw(key, keyLen, keyPassword, cert, certLen, certPassword))
return pCert;
RELEASEOBJECT(pCert);
return NULL;
}
int GetOOXMLHashAlg(const std::string& sAlg)
{
if ("http://www.w3.org/2000/09/xmldsig#rsa-sha1" == sAlg ||

View File

@ -1,7 +1,7 @@
#include "../../../common/File.h"
#include "../include/XmlCertificate.h"
#include "../src/XmlSigner_openssl.h"
#include "../include/Certificate.h"
#include "../include/CertificateCommon.h"
#include "../include/OOXMLSigner.h"
#include "../include/OOXMLVerifier.h"
@ -39,7 +39,7 @@ public:
class CCertificate
{
public:
CCertificate_openssl* m_pCert;
ICertificate* m_pCert;
private:
unsigned char* m_key;
@ -53,7 +53,7 @@ private:
public:
CCertificate()
{
m_pCert = new CCertificate_openssl();
m_pCert = NULL;
}
~CCertificate()
{
@ -104,7 +104,7 @@ public:
void Load()
{
m_pCert->FromFilesRaw(m_key, m_keyLen, m_keyPass, m_cert, m_certLen, m_certPass);
m_pCert = NSCertificate::FromFilesRaw(m_key, m_keyLen, m_keyPass, m_cert, m_certLen, m_certPass);
}
ICertificate* GetCertificate()

View File

@ -0,0 +1,3 @@
xml
openssl

View File

@ -4,6 +4,7 @@ sys.path.append("../../../../../Common/js")
import base
import os
import codecs
import common
def run_as_bash(file, commands):
if base.is_file(file):
@ -26,6 +27,7 @@ if not base.is_dir("openssl"):
base.cmd("git", ["clone", "--depth=1", "--branch", "OpenSSL_1_1_1f", "https://github.com/openssl/openssl.git"])
# correct for wasm builds
common.apply_patch("./openssl/crypto/rand/rand_lib.c", "./patches/openssl1.patch")
base.copy_file("../../../../../Common/3dParty/openssl/openssl/apps/progs.h", "./openssl/apps/progs.h")
if not base.is_dir("xml"):
base.print_info("Copy xml...")
@ -34,11 +36,12 @@ if not base.is_dir("xml"):
base.replaceInFile("./xml/libxml2/xmlIO.c", "xmlNop(void)", "xmlNop(void* context, char* buffer, int len)")
base.replaceInFile("./xml/src/xmllight_private.h", "#include \"../../common/", "#include \"../../../../../../common/")
base.replaceInFile("./xml/include/xmlutils.h", "#include \"../../common/", "#include \"../../../../../../common/")
base.replaceInFile("./xml/include/xmlwriter.h", "#include \"../../common/", "#include \"../../../../../../common/")
# compile openssl
if not base.is_file("./openssl/libcrypto.a"):
base.print_info("Compile openssl...")
os.chdir("./openssl")
#run_as_bash("./compile_openssl.sh", ["./config no-shared no-asm no-ssl2 no-ssl3", "source ./../emsdk/emsdk_env.sh", "export CC=emcc", "export CXX=emcc", "make"])
run_as_bash("./compile_openssl.sh", ["source ./../emsdk/emsdk_env.sh", "emconfigure ./config no-shared no-asm no-threads", "sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile", "emmake make build_generated libssl.a libcrypto.a"])
run_as_bash("./compile_openssl.sh", ["source ./../../../../../../Common/js/emsdk/emsdk_env.sh", "emconfigure ./config no-shared no-asm no-threads", "sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile", "emmake make build_generated libssl.a libcrypto.a"])
os.chdir("../")

View File

@ -65,7 +65,7 @@
{
"name": "s",
"folder": "../../../../xmlsec/src/src/",
"files": ["XmlTransform.cpp", "XmlCertificate.cpp", "OOXMLSigner.cpp", "OOXMLVerifier.cpp", "XmlSigner_openssl.cpp"]
"files": ["XmlTransform.cpp", "CertificateCommon.cpp", "OOXMLSigner.cpp", "OOXMLVerifier.cpp"]
},
{
"name": "a",

View File

@ -871,7 +871,7 @@ void ECMAWriteProtect::Generate()
_buf pHashBuf = HashAppend(pSalt, pPassword, data.hashAlgorithm);
for (int i = 0; i < data.spinCount; i++)
for (_UINT32 i = 0; i < data.spinCount; i++)
{
_buf iterator((unsigned char*)&i, 4, false);
pHashBuf = HashAppend(pHashBuf, iterator, data.hashAlgorithm);
@ -913,7 +913,7 @@ bool ECMAWriteProtect::Verify()
_buf pHashTest = HashAppend(pSalt, pPassword, data.hashAlgorithm);
for (int i = 0; i < data.spinCount; i++)
for (_UINT32 i = 0; i < data.spinCount; i++)
{
_buf iterator((unsigned char*)&i, 4, false);
pHashTest = HashAppend(pHashTest, iterator, data.hashAlgorithm);

View File

@ -1854,6 +1854,8 @@ HRESULT CPdfRenderer::AddFormField(const CFormFieldInfo &oInfo)
pField->SetPlaceHolderText(wsPlaceHolder, oNormalColor, oPlaceHolderColor);
}
pField->SetFormat(pPr->GetFormatPr());
}
else if (oInfo.IsDropDownList())
{

View File

@ -104,6 +104,40 @@ namespace PdfWriter
Add("Ff", nFlags);
}
CDictObject* CFieldBase::GetAA()
{
CDictObject* pAA = dynamic_cast<CDictObject*>(this->Get("AA"));
if (pAA)
return pAA;
pAA = new CDictObject();
if (!pAA)
return NULL;
Add("AA", pAA);
return pAA;
}
void CFieldBase::AddScriptToAA(const std::string& sKey, const std::string& sScript, CDictObject* pAA)
{
if (sScript.empty())
return;
CDictObject* _pAA = pAA;
if (!_pAA)
_pAA = GetAA();
if (!_pAA)
return;
CDictObject* pKey = new CDictObject();
if (!pKey)
return;
m_pXref->Add(pKey);
pAA->Add(sKey.c_str(), pKey);
pKey->Add("S", "JavaScript");
pKey->Add("JS", new CStringObject(sScript.c_str(), true, true));
}
void CFieldBase::AddPageRect(CPage* pPage, const TRect& oRect)
{
if (!pPage)
@ -476,19 +510,17 @@ namespace PdfWriter
std::string sText = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(vPlaceHolders[vPlaceHolders.size() - 1]);
const TRgb& oColor = vPlaceHolderColors[vPlaceHolderColors.size() - 1];
std::string sBlur = "\nif (event.target.value == \"\")\n{ event.target.value = \"" + sText + "\";\n event.target.textColor =[\"RGB\", " +
std::string sBlur = "\nif (event.target.value == \"\")\n{\n event.target.textColor =[\"RGB\", " +
std::to_string(oColor.r) + ", " +
std::to_string(oColor.g) + ", " +
std::to_string(oColor.b) + "];\n}";
std::to_string(oColor.b) + "];\nevent.target.value = \"" + sText + "\";\n}";
if (!m_pFocus || !m_pBlur)
{
CDictObject* pAA = new CDictObject();
CDictObject* pAA = GetAA();
if (!pAA)
return;
Add("AA", pAA);
CDictObject* pFocus = new CDictObject();
CDictObject* pBlur = new CDictObject();
if (!pFocus || !pBlur)
@ -588,6 +620,83 @@ namespace PdfWriter
{
return m_oPlaceHolderColor;
}
void CFieldBase::SetFormat(const CFormFieldInfo::CTextFormFormat* pFormat)
{
if (!pFormat || pFormat->IsEmpty())
return;
std::string scriptK, scriptF, scriptV;
const TRgb& oNormalColor = GetNormalColor();
const std::string prefix = "var curColor = color.convert(event.target.textColor, \"RGB\");\nif (Math.abs(curColor[1] - " + std::to_string(oNormalColor.r) +
") < 0.005 && Math.abs(curColor[2] - " + std::to_string(oNormalColor.g) +
") < 0.005 && Math.abs(curColor[3] - " + std::to_string(oNormalColor.b) +
") < 0.005)\n{";
const std::string postfix = "}";
if (pFormat->GetSymbolsCount())
{
scriptK += "\nvar s=String.fromCharCode(";
scriptV += "\nvar s=String.fromCharCode(";
for (unsigned int unIndex = 0, unCount = pFormat->GetSymbolsCount(); unIndex < unCount; ++unIndex)
{
if (unIndex)
{
scriptK += ", ";
scriptV += ", ";
}
scriptK += std::to_string(pFormat->GetSymbol(unIndex));
scriptV += std::to_string(pFormat->GetSymbol(unIndex));
}
scriptK += ");";
scriptV += ");";
scriptK += "\nfor (var i = 0, l = event.change.length; i < l; ++i){\nvar c = event.change.charAt(i);\nif(-1 == s.indexOf(c)){\nevent.rc = false;\nbreak;\n}\n}";
scriptV += "\nfor (var i = 0, l = event.value.length; i < l; ++i){\nvar c = event.value.charAt(i);\nif(-1 == s.indexOf(c)){\nevent.rc = false;\nbreak;\n}\n}";
}
if (pFormat->IsDigit())
{
scriptK += "\nif(false !== event.rc)\n{for(var i = 0, l = event.change.length; i < l; ++i){var c = event.change.charCodeAt(i);if(c < 48 || c > 57){event.rc = false;break;}}}";
scriptV += "\nfor(var i = 0, l = event.value.length; i < l; ++i){var c = event.value.charCodeAt(i);if(c < 48 || c > 57){event.rc = false;break;}}";
}
else if (pFormat->IsLetter())
{
scriptK += "\nvar r=/^[^\\d.!?\\/\\\\+\\-\\x20'\":;\\(\\)\\[\\]\\{\\}=_@#$%^&*]+$/;\nif(false !== event.rc)\n{for(var i = 0, l = event.change.length; i < l; ++i){var c = event.change.charCodeAt(i);if(!r.test(String.fromCharCode(c))){event.rc = false;break;}}}";
scriptV += "\nvar r=/^[^\\d.!?\\/\\\\+\\-\\x20'\":;\\(\\)\\[\\]\\{\\}=_@#$%^&*]+$/;\nfor(var i = 0, l = event.value.length; i < l; ++i){var c = event.value.charCodeAt(i);if(!r.test(String.fromCharCode(c))){event.rc = false;break;}}";
}
else if (pFormat->IsMask())
{
scriptK += "\nAFSpecial_KeystrokeEx(\"" + NSFile::CUtf8Converter::GetUtf8StringFromUnicode(pFormat->GetMask()) + "\");";
}
else if (pFormat->IsRegExp())
{
scriptV += "\nvar r=/" + NSFile::CUtf8Converter::GetUtf8StringFromUnicode(pFormat->GetRegExp()) + "/;";
scriptV += "\nif(event.value)event.rc=!!event.value.match(r);";
}
CDictObject* pAA = GetAA();
if (!scriptK.empty())
{
scriptK = prefix + scriptK + postfix;
AddScriptToAA("K", scriptK, pAA);
}
if (!scriptV.empty())
{
scriptV = prefix + scriptV + postfix;
AddScriptToAA("V", scriptV, pAA);
}
if (!scriptF.empty())
{
scriptV = prefix + scriptF + postfix;
AddScriptToAA("F", scriptF, pAA);
}
}
//----------------------------------------------------------------------------------------
// CTextField
//----------------------------------------------------------------------------------------
@ -745,12 +854,10 @@ namespace PdfWriter
}
void CChoiceField::SetPlaceHolderText(const std::wstring& wsText, const TRgb& oNormalColor, const TRgb& oPlaceHolderColor)
{
CDictObject* pAA = new CDictObject();
CDictObject* pAA = GetAA();
if (!pAA)
return;
Add("AA", pAA);
CDictObject* pFocus = new CDictObject();
CDictObject* pBlur = new CDictObject();
if (!pFocus || !pBlur)
@ -812,10 +919,10 @@ namespace PdfWriter
") < 0.005 && Math.abs(curColor[3] - " + std::to_string(oPlaceHolderColor.b) +
") < 0.005)\n event.target.value = \"\";";
sBlur = "\nif (event.target.value == \"\")\n{ event.target.value = \"" + sText + "\";\n event.target.textColor = [\"RGB\", " +
sBlur = "\nif (event.target.value == \"\")\n{\n event.target.textColor = [\"RGB\", " +
std::to_string(oPlaceHolderColor.r) + ", " +
std::to_string(oPlaceHolderColor.g) + ", " +
std::to_string(oPlaceHolderColor.b) + "];\n}";
std::to_string(oPlaceHolderColor.b) + "];\nevent.target.value = \"" + sText + "\";\n}";
}
m_pXref->Add(pFocus);

View File

@ -36,6 +36,7 @@
#include "Objects.h"
#include "Types.h"
#include "Annotation.h"
#include "../DesktopEditor/graphics/IRenderer.h"
namespace PdfWriter
{
@ -100,11 +101,15 @@ namespace PdfWriter
const std::wstring& GetPlaceHolderText();
const TRgb& GetNormalColor();
const TRgb& GetPlaceHolderColor();
void SetFormat(const CFormFieldInfo::CTextFormFormat* pFormat);
protected:
virtual void SetPlaceHolderText(const std::vector<std::wstring>& vPlaceHolders, const std::vector<TRgb>& vNormalColors, const std::vector<TRgb>& vPlaceHolderColors);
void SetFlag(bool isFlag, int nBitPosition);
CDictObject* GetAA();
void AddScriptToAA(const std::string& sKey, const std::string& sScript, CDictObject* pAA = NULL);
protected:

View File

@ -3159,22 +3159,17 @@ namespace NExtractTools
Oox2Odf::Converter converter(sXlsxDir, L"spreadsheet", params.getFontPath(), bTemplate);
_UINT32 nRes = 0;
try
{
std::wstring password = params.getSavePassword();
std::wstring documentID = params.getDocumentID();
converter.convert();
converter.write(sTempUnpackedODS, sTemp, password, documentID);
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
catch(...)
{
nRes = AVS_FILEUTILS_ERROR_CONVERT;
}
return nRes;
std::wstring password = params.getSavePassword();
std::wstring documentID = params.getDocumentID();
converter.convert();
converter.write(sTempUnpackedODS, sTemp, password, documentID);
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
return nRes;
}
_UINT32 mscrypt2oot (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)

View File

@ -634,6 +634,7 @@ void CSVWriter::Impl::WriteCell(OOX::Spreadsheet::CCell *pCell)
// sCellValue = *pCell->m_oCacheValue;
//}
//else
bool bString = false;
if (pCell->m_oValue.IsInit())
{
sCellValue = pCell->m_oValue->ToString();
@ -648,42 +649,47 @@ void CSVWriter::Impl::WriteCell(OOX::Spreadsheet::CCell *pCell)
if (NULL != pSi)
{
sCellValue = pSi->ToString();
bString = true;
}
}
}
std::wstring format_code;
if (pCell->m_oStyle.IsInit() && m_oXlsx.m_pStyles)
if (!bString)
{
OOX::Spreadsheet::CXfs* xfs = m_oXlsx.m_pStyles->m_oCellXfs->m_arrItems[*pCell->m_oStyle];
if (xfs)
std::wstring format_code;
if (pCell->m_oStyle.IsInit() && m_oXlsx.m_pStyles)
{
if ((xfs->m_oApplyNumberFormat.IsInit()) && (xfs->m_oApplyNumberFormat->ToBool()) || !xfs->m_oApplyNumberFormat.IsInit())
OOX::Spreadsheet::CXfs* xfs = m_oXlsx.m_pStyles->m_oCellXfs->m_arrItems[*pCell->m_oStyle];
if (xfs)
{
if ((xfs->m_oNumFmtId.IsInit()) /*&& (xfs->m_oNumFmtId->GetValue() != 0*/)
if ((xfs->m_oApplyNumberFormat.IsInit()) && (xfs->m_oApplyNumberFormat->ToBool()) || !xfs->m_oApplyNumberFormat.IsInit())
{
int numFmt = xfs->m_oNumFmtId->GetValue();
GetDefaultFormatCode(numFmt, format_code, format_type);
if (m_oXlsx.m_pStyles->m_oNumFmts.IsInit())
if ((xfs->m_oNumFmtId.IsInit()) /*&& (xfs->m_oNumFmtId->GetValue() != 0*/)
{
std::map<unsigned int, size_t>::iterator pFind = m_oXlsx.m_pStyles->m_oNumFmts->m_mapNumFmtIndex.find(numFmt);
if (pFind != m_oXlsx.m_pStyles->m_oNumFmts->m_mapNumFmtIndex.end())
int numFmt = xfs->m_oNumFmtId->GetValue();
GetDefaultFormatCode(numFmt, format_code, format_type);
if (m_oXlsx.m_pStyles->m_oNumFmts.IsInit())
{
OOX::Spreadsheet::CNumFmt *fmt = m_oXlsx.m_pStyles->m_oNumFmts->m_arrItems[pFind->second];
if (fmt)
std::map<unsigned int, size_t>::iterator pFind = m_oXlsx.m_pStyles->m_oNumFmts->m_mapNumFmtIndex.find(numFmt);
if (pFind != m_oXlsx.m_pStyles->m_oNumFmts->m_mapNumFmtIndex.end())
{
if (fmt->m_oFormatCode.IsInit())
format_code = *fmt->m_oFormatCode;
OOX::Spreadsheet::CNumFmt *fmt = m_oXlsx.m_pStyles->m_oNumFmts->m_arrItems[pFind->second];
if (fmt)
{
if (fmt->m_oFormatCode.IsInit())
format_code = *fmt->m_oFormatCode;
}
}
}
}
}
}
}
sCellValue = ConvertValueCellToString(sCellValue, format_type, format_code);
}
sCellValue = ConvertValueCellToString(sCellValue, format_type, format_code);
}
// Escape cell value
@ -837,10 +843,9 @@ std::wstring CSVWriter::Impl::ConvertValueCellToString(const std::wstring &value
try
{
std::wstring format_code_tmp;
double dValue = XmlUtils::GetDouble(value);
int count_d = 0;
bool bFloat = false, bStart = true, bEnd = false;
bool bFloat = false, bStart = true, bEnd = false, bPercent = false;
size_t pos_skip = format_code.rfind(L"#");
if (pos_skip == std::wstring::npos) pos_skip = 0;
@ -886,7 +891,7 @@ std::wstring CSVWriter::Impl::ConvertValueCellToString(const std::wstring &value
{
if (format_code[i] == L'%')
{
dValue *= 100.;
bPercent = true;
format_code_tmp += (std::wstring(L"%") + format_code[i]);
}
else
@ -906,10 +911,26 @@ std::wstring CSVWriter::Impl::ConvertValueCellToString(const std::wstring &value
bStart = false;
}
if (!bStart && !bEnd) format_code_tmp += bFloat ? L"f" : L"d";
else
format_code_tmp += L"%";
if (!bStart && !bEnd) format_code_tmp += bFloat ? L"f" : L"ld";
double dValue = XmlUtils::GetDouble(value);
if (bPercent)
dValue *= 100.;
std::wstringstream stream;
stream << boost::wformat(format_code_tmp) % dValue;
if (bFloat)
{
stream << boost::wformat(format_code_tmp) % dValue;
}
else
{
_INT64 iValue = dValue;
stream << boost::wformat(format_code_tmp) % iValue;
}
return stream.str();
}