mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fiix bug #59353
This commit is contained in:
@ -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::ns = L"text";
|
||||||
const wchar_t * variable_set::name = L"variable-set";
|
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 )
|
void variable_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||||
{
|
{
|
||||||
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
|
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)
|
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";
|
const wchar_t * variable_decl::ns = L"text";
|
||||||
|
|||||||
@ -864,16 +864,18 @@ public:
|
|||||||
void docx_convert(oox::docx_conversion_context & Context);
|
void docx_convert(oox::docx_conversion_context & Context);
|
||||||
|
|
||||||
private:
|
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){}
|
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_;
|
odf_types::common_value_and_type_attlist office_value_;
|
||||||
_CP_OPT(std::wstring) office_formula_;
|
_CP_OPT(std::wstring) office_formula_;
|
||||||
|
|
||||||
_CP_OPT(std::wstring) style_data_style_name_;
|
_CP_OPT(std::wstring) style_data_style_name_;
|
||||||
_CP_OPT(std::wstring) display_;
|
_CP_OPT(std::wstring) display_;
|
||||||
_CP_OPT(std::wstring) name_;
|
_CP_OPT(std::wstring) name_;
|
||||||
|
|
||||||
|
office_element_ptr_array content_;
|
||||||
};
|
};
|
||||||
CP_REGISTER_OFFICE_ELEMENT2(variable_set);
|
CP_REGISTER_OFFICE_ELEMENT2(variable_set);
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -201,13 +201,13 @@ namespace odf_writer
|
|||||||
if (sz < 1)
|
if (sz < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
content_utf8_ += GetUtf8StringFromUnicode(Content.c_str() + pos, sz);
|
content_utf8_ += NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content.c_str() + pos, sz);
|
||||||
|
|
||||||
pos += sz;
|
pos += sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
content_utf8_ = GetUtf8StringFromUnicode(Content.c_str(), Content.length());
|
content_utf8_ = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content.c_str(), Content.length());
|
||||||
}else
|
}else
|
||||||
content_utf8_ = std::string( Content.begin(), Content.end());
|
content_utf8_ = std::string( Content.begin(), Content.end());
|
||||||
}
|
}
|
||||||
@ -226,13 +226,13 @@ namespace odf_writer
|
|||||||
if (sz < 1)
|
if (sz < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
content_utf8_ += GetUtf8StringFromUnicode(Content + pos, sz);
|
content_utf8_ += NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content + pos, sz);
|
||||||
|
|
||||||
pos += sz;
|
pos += sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
content_utf8_ = GetUtf8StringFromUnicode(Content, Size);
|
content_utf8_ = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(Content, Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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());
|
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());
|
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());
|
style *style_ = dynamic_cast<style*>(style_elm.get());
|
||||||
if (style_)
|
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())
|
else if (false == parent_paragraph_style_.empty())
|
||||||
{
|
{
|
||||||
text_p* p = dynamic_cast<text_p*>(elm.get());
|
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());
|
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_)
|
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()))
|
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()))
|
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_elm = style_->get_office_element();
|
||||||
current_level_[i].style_name = style_->get_name();
|
current_level_[i].style_name = style_->get_name();
|
||||||
|
|
||||||
if (p) p->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_.paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
|
if (h) h->paragraph_attrs_.text_style_name_ = current_level_[i].style_name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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());
|
text_p *p = dynamic_cast<text_p*>(error_message->content_.back().get());
|
||||||
if (p)
|
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());
|
text_p *p = dynamic_cast<text_p*>(help_message->content_.back().get());
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
p->paragraph_.add_text(content);
|
p->add_text(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -564,24 +564,6 @@ void table_columns_and_groups::serialize(std::wostream & strm)
|
|||||||
content_[i]->serialize(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
|
||||||
// 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)
|
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)
|
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)
|
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_.serialize(CP_GET_XML_NODE());
|
||||||
attlist_extra_.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)
|
void table_covered_table_cell::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||||
{
|
{
|
||||||
empty_ = false;
|
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)
|
void table_covered_table_cell::add_child_element( const office_element_ptr & child_element)
|
||||||
{
|
{
|
||||||
empty_ = false;
|
empty_ = false;
|
||||||
content_.add_child_element(child_element);
|
content_.push_back(child_element);
|
||||||
}
|
}
|
||||||
void table_covered_table_cell::serialize(std::wostream & _Wostream)
|
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());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -405,22 +405,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
|
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>
|
class table_table_cell : public office_element_impl<table_table_cell>
|
||||||
{
|
{
|
||||||
@ -430,9 +414,7 @@ public:
|
|||||||
|
|
||||||
static const ElementType type = typeTableTableCell;
|
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 create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||||
virtual void add_child_element( const office_element_ptr & child_element);
|
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 attlist_;
|
||||||
table_table_cell_attlist_extra attlist_extra_;
|
table_table_cell_attlist_extra attlist_extra_;
|
||||||
table_table_cell_content content_;
|
|
||||||
|
|
||||||
|
office_element_ptr_array content_;
|
||||||
};
|
};
|
||||||
|
|
||||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
|
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------
|
||||||
@ -456,8 +437,6 @@ public:
|
|||||||
|
|
||||||
static const ElementType type = typeTableCoveredTableCell;
|
static const ElementType type = typeTableCoveredTableCell;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
table_covered_table_cell() {empty_ = true; }
|
table_covered_table_cell() {empty_ = true; }
|
||||||
|
|
||||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||||
@ -467,7 +446,7 @@ public:
|
|||||||
|
|
||||||
bool empty_;
|
bool empty_;
|
||||||
table_table_cell_attlist attlist_;
|
table_table_cell_attlist attlist_;
|
||||||
table_table_cell_content content_;
|
office_element_ptr_array content_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -58,33 +58,6 @@ using xml::xml_char_wc;
|
|||||||
const wchar_t * text_h::ns = L"text";
|
const wchar_t * text_h::ns = L"text";
|
||||||
const wchar_t * text_h::name = L"h";
|
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)
|
void paragraph_attrs::serialize(CP_ATTR_NODE)
|
||||||
{
|
{
|
||||||
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
|
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_OPT (L"text:start-value", text_start_value_);
|
||||||
CP_XML_ATTR (L"text:is-list-header", text_is_list_header_);
|
CP_XML_ATTR (L"text:is-list-header", text_is_list_header_);
|
||||||
|
|
||||||
paragraph_.serialize_attr (CP_GET_XML_NODE());
|
paragraph_attrs_.serialize(CP_GET_XML_NODE());
|
||||||
paragraph_.serialize (CP_XML_STREAM());
|
|
||||||
|
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)
|
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)
|
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)
|
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
|
// 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)
|
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)
|
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)
|
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)
|
void text_p::serialize(std::wostream & _Wostream)
|
||||||
@ -159,8 +138,12 @@ void text_p::serialize(std::wostream & _Wostream)
|
|||||||
{
|
{
|
||||||
CP_XML_NODE_SIMPLE()
|
CP_XML_NODE_SIMPLE()
|
||||||
{
|
{
|
||||||
paragraph_.serialize_attr (CP_GET_XML_NODE());
|
paragraph_attrs_.serialize(CP_GET_XML_NODE());
|
||||||
paragraph_.serialize (CP_XML_STREAM());
|
|
||||||
|
for (size_t i = 0; i < paragraph_content_.size(); i++)
|
||||||
|
{
|
||||||
|
paragraph_content_[i]->serialize(CP_XML_STREAM());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,29 +59,6 @@ public:
|
|||||||
void serialize(CP_ATTR_NODE);
|
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>
|
class text_h : public office_element_impl<text_h>
|
||||||
{
|
{
|
||||||
@ -101,18 +78,15 @@ public:
|
|||||||
|
|
||||||
virtual void add_text(const std::wstring & Text);
|
virtual void add_text(const std::wstring & Text);
|
||||||
|
|
||||||
// heading-attrs
|
|
||||||
unsigned int text_outline_level_;
|
unsigned int text_outline_level_;
|
||||||
bool text_restart_numbering_; // default false
|
bool text_restart_numbering_; // default false
|
||||||
_CP_OPT(unsigned int) text_start_value_;
|
_CP_OPT(unsigned int) text_start_value_;
|
||||||
bool text_is_list_header_; // default false
|
bool text_is_list_header_; // default false
|
||||||
_CP_OPT(std::wstring) text_number_;
|
_CP_OPT(std::wstring) text_number_;
|
||||||
|
|
||||||
paragraph paragraph_;
|
paragraph_attrs paragraph_attrs_;
|
||||||
|
office_element_ptr_array paragraph_content_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CP_REGISTER_OFFICE_ELEMENT2(text_h);
|
CP_REGISTER_OFFICE_ELEMENT2(text_h);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
@ -122,8 +96,7 @@ public:
|
|||||||
static const wchar_t * ns;
|
static const wchar_t * ns;
|
||||||
static const wchar_t * name;
|
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 create_child_element(const std::wstring & Ns, const std::wstring & Name);
|
||||||
virtual void add_child_element( const office_element_ptr & child_element);
|
virtual void add_child_element( const office_element_ptr & child_element);
|
||||||
@ -131,13 +104,13 @@ public:
|
|||||||
virtual void serialize(std::wostream & _Wostream);
|
virtual void serialize(std::wostream & _Wostream);
|
||||||
|
|
||||||
text_p(){};
|
text_p(){};
|
||||||
paragraph paragraph_;
|
|
||||||
|
paragraph_attrs paragraph_attrs_;
|
||||||
|
office_element_ptr_array paragraph_content_;
|
||||||
|
|
||||||
virtual void add_text(const std::wstring & Text);
|
virtual void add_text(const std::wstring & Text);
|
||||||
};
|
};
|
||||||
|
|
||||||
CP_REGISTER_OFFICE_ELEMENT2(text_p);
|
CP_REGISTER_OFFICE_ELEMENT2(text_p);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
class text_list : public office_element_impl<text_list>
|
class text_list : public office_element_impl<text_list>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user