mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fix bug #69488
This commit is contained in:
@ -35,6 +35,7 @@
|
||||
#include "office_spreadsheet.h"
|
||||
#include "office_scripts.h"
|
||||
#include "office_chart.h"
|
||||
#include "office_meta.h"
|
||||
|
||||
#include "office_elements_create.h"
|
||||
|
||||
@ -525,6 +526,21 @@ void odf_conversion_context::add_meta(const office_element_ptr& elm)
|
||||
if (!elm) return;
|
||||
objects_[current_object_]->meta.push_back(elm);
|
||||
}
|
||||
void odf_conversion_context::add_meta_user_define(const std::wstring& name, const std::wstring& content)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"meta", L"user-defined", elm, this, true);
|
||||
|
||||
meta_user_defined* meta_user = dynamic_cast<meta_user_defined*>(elm.get());
|
||||
if (meta_user)
|
||||
{
|
||||
meta_user->meta_name_ = name;
|
||||
meta_user->content_ = content;
|
||||
meta_user->meta_value_type_ = odf_types::office_value_type::String;
|
||||
|
||||
add_meta(elm);
|
||||
}
|
||||
}
|
||||
void odf_conversion_context::add_meta(const std::wstring & ns, const std::wstring & name, const std::wstring & content)
|
||||
{
|
||||
if (name.empty()) return;
|
||||
|
||||
@ -128,6 +128,7 @@ public:
|
||||
|
||||
void add_meta(const std::wstring & ns, const std::wstring & name, const std::wstring & content);
|
||||
void add_meta(const office_element_ptr &elm);
|
||||
void add_meta_user_define(const std::wstring& name, const std::wstring& content);
|
||||
|
||||
virtual odf_style_context_ptr styles_context();
|
||||
virtual void set_styles_context(odf_style_context_ptr styles_context);
|
||||
|
||||
@ -139,15 +139,7 @@ void odt_conversion_context::end_document()
|
||||
office_element_ptr elm;
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = mapUserDefineds.begin(); it != mapUserDefineds.end(); ++it)
|
||||
{
|
||||
create_element(L"meta", L"user-defined", elm, this, true);
|
||||
|
||||
meta_user_defined * meta_user = dynamic_cast<meta_user_defined*>(elm.get());
|
||||
if (meta_user)
|
||||
{
|
||||
meta_user->meta_name_ = it->first;
|
||||
meta_user->add_text(it->second);
|
||||
add_meta(elm);
|
||||
}
|
||||
add_meta_user_define(it->first, it->second);
|
||||
}
|
||||
}
|
||||
if (controls_context()->is_exist_content())
|
||||
|
||||
@ -229,14 +229,12 @@ void meta_user_defined::serialize(std::wostream & _Wostream)
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR(L"meta:name", meta_name_);
|
||||
CP_XML_ATTR(L"meta:value-type", meta_value_type_);
|
||||
|
||||
CP_XML_STREAM() << XmlUtils::EncodeXmlString(content_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void meta_user_defined::add_text(const std::wstring & text)
|
||||
{
|
||||
content_ = text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@
|
||||
#include "office_elements.h"
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include "../../DataTypes/common_attlists.h"
|
||||
#include "../../DataTypes/officevaluetype.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
@ -267,7 +270,8 @@ public:
|
||||
_CP_OPT(int) syllable_count_;
|
||||
|
||||
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 serialize(std::wostream & _Wostream);
|
||||
virtual void add_child_element(const office_element_ptr & child_element) {}
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_document_statistic);
|
||||
|
||||
@ -281,10 +285,11 @@ public:
|
||||
static const ElementType type = typeOfficeMetaUserDefined;
|
||||
|
||||
std::wstring meta_name_;
|
||||
std::wstring content_;
|
||||
std::wstring content_;
|
||||
_CP_OPT(odf_types::office_value_type) meta_value_type_;
|
||||
|
||||
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_text(const std::wstring & Text);
|
||||
virtual void add_child_element(const office_element_ptr & child_element) {}
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_user_defined);
|
||||
|
||||
Reference in New Issue
Block a user