mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fix bug #77963
This commit is contained in:
@ -42,30 +42,22 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
_CP_PTR(oox_axis_content) oox_axis_content::create(int type, unsigned int id)
|
||||
_CP_PTR(oox_axis_content) oox_axis_content::create(unsigned int id)
|
||||
{
|
||||
return boost::make_shared<oox_axis_content>(type, id);
|
||||
return boost::make_shared<oox_axis_content>(id);
|
||||
}
|
||||
|
||||
oox_axis_content::oox_axis_content(int type/*,std::wstring name*/, unsigned int id)
|
||||
oox_axis_content::oox_axis_content(unsigned int id)
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
id_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
id_ = id;
|
||||
}
|
||||
type_ = type;
|
||||
id_ = id;
|
||||
}
|
||||
void oox_axis_content::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (id_ < 1 ) return; //not activate, blank axis
|
||||
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
switch(type_)
|
||||
switch(content_.type_)
|
||||
{
|
||||
case 1:
|
||||
CP_XML_NODE(L"c:catAx")
|
||||
|
||||
@ -50,10 +50,10 @@ class oox_axis_content
|
||||
public:
|
||||
odf_reader::chart::oox_typeconvert oox_typeconvert_;
|
||||
|
||||
oox_axis_content(int type/*,std::wstring name*/, unsigned int id);
|
||||
oox_axis_content(unsigned int id);
|
||||
~oox_axis_content(){}
|
||||
|
||||
static oox_axis_content_ptr create(int type/*,std::wstring name*/, unsigned int id);
|
||||
static oox_axis_content_ptr create(unsigned int id);
|
||||
|
||||
void oox_serialize(std::wostream & _Wostream);
|
||||
void oox_serialize_content(std::wostream & _Wostream);
|
||||
@ -61,11 +61,9 @@ public:
|
||||
int get_Id(){return id_;}
|
||||
void add_CrossedId (int id){cross_id_.push_back( id);}
|
||||
|
||||
unsigned int id_;
|
||||
unsigned int id_;
|
||||
std::vector<int> cross_id_;
|
||||
odf_reader::chart::axis content_;
|
||||
|
||||
int type_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -73,9 +73,9 @@ public:
|
||||
{
|
||||
plot_area_.set_data_table(v);
|
||||
}
|
||||
void add_axis(int type, odf_reader::chart::axis & content)
|
||||
void add_axis(odf_reader::chart::axis & content)
|
||||
{
|
||||
plot_area_.add_axis(type, content);
|
||||
plot_area_.add_axis(content);
|
||||
}
|
||||
void set_3D_chart(bool val)
|
||||
{
|
||||
|
||||
@ -102,10 +102,10 @@ namespace cpdoccore {
|
||||
charts_.push_back(chart);
|
||||
}
|
||||
|
||||
void oox_plot_area::add_axis(int type, odf_reader::chart::axis& content)
|
||||
void oox_plot_area::add_axis(odf_reader::chart::axis& content)
|
||||
{
|
||||
unsigned int id = axis_id_++;
|
||||
oox_axis_content_ptr ax = oox_axis_content::create(type, id);
|
||||
oox_axis_content_ptr ax = oox_axis_content::create(id);
|
||||
ax->content_ = content;
|
||||
|
||||
if (content.dimension_ == L"x") axis_.insert(axis_.begin(), ax);
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
void oox_serialize_view3D(std::wostream & _Wostream);
|
||||
|
||||
void add_chart (int type);
|
||||
void add_axis (int type, odf_reader::chart::axis & content);
|
||||
void add_axis (odf_reader::chart::axis & content);
|
||||
|
||||
void set_no_local_table (bool val); //whithout embedded tables
|
||||
//void set_content_series (odf_reader::chart::series & content);
|
||||
|
||||
@ -617,7 +617,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (a.dimension_ == L"y" && y_enabled)continue;
|
||||
if (a.dimension_ == L"z" && z_enabled)continue;
|
||||
|
||||
if (a.dimension_ == L"x")//могут быть типы 1, 2, 3, 4
|
||||
if (a.dimension_ == L"x")
|
||||
{
|
||||
if (last_set_class == chart_class::scatter ||
|
||||
last_set_class == chart_class::bubble) a.type_ = 2;
|
||||
@ -637,9 +637,6 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
a.type_ = 2;
|
||||
if (last_set_class == chart_class::bar)
|
||||
{
|
||||
//вот нахрена свойства относящиеся к серии и самому чарту воткнули в оси ???? (ооо писали идиеты???)
|
||||
//или это банальная ошибка которую так никогда и не исправили???
|
||||
//overlap & gap-width
|
||||
oox::oox_chart_ptr current = chart_context.get_current_chart();
|
||||
current->set_graphic_properties(a.graphic_properties_);
|
||||
}
|
||||
@ -653,7 +650,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
z_enabled = true;
|
||||
}
|
||||
|
||||
chart_context.add_axis(a.bCategories_ ? 1 : a.type_, a);
|
||||
chart_context.add_axis(a);
|
||||
}
|
||||
|
||||
if (bIs3D.get_value_or(false))
|
||||
@ -663,7 +660,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
chart::axis a;
|
||||
a.type_ = 0; // blank
|
||||
|
||||
chart_context.add_axis(a.type_, a);
|
||||
chart_context.add_axis(a);
|
||||
}
|
||||
chart_context.set_3D_chart (true);
|
||||
}
|
||||
@ -1021,6 +1018,15 @@ void process_build_object::visit(chart_axis& val)
|
||||
val.attlist_.chart_name_.get_value_or(L""),
|
||||
val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""));
|
||||
|
||||
if (val.attlist_.axis_type_)
|
||||
{
|
||||
if (val.attlist_.axis_type_->get_type() == odf_types::chart_axis_type::date)
|
||||
object_odf_context_.axises_.back().type_ = 4;
|
||||
else if (val.attlist_.axis_type_->get_type() == odf_types::chart_axis_type::text)
|
||||
object_odf_context_.axises_.back().type_ = 1;
|
||||
|
||||
}
|
||||
|
||||
ACCEPT_ALL_CONTENT(val.content_);
|
||||
|
||||
std::wstring style_name = val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
|
||||
@ -1124,11 +1130,11 @@ void process_build_object::visit(chart_mean_value & val)
|
||||
}
|
||||
void process_build_object::visit(chart_date_scale & val)
|
||||
{
|
||||
object_odf_context_.axises_.back().type_ = 4;
|
||||
//...
|
||||
}
|
||||
void process_build_object::visit(chartooo_date_scale & val)
|
||||
{
|
||||
object_odf_context_.axises_.back().type_ = 4;
|
||||
//...
|
||||
}
|
||||
void process_build_object::visit(chart_error_indicator & val)
|
||||
{
|
||||
|
||||
@ -102,7 +102,7 @@ namespace chart {
|
||||
graphic_format_properties_ptr graphic_properties_;
|
||||
};
|
||||
bool bCategories_ = false;
|
||||
|
||||
|
||||
title title_;
|
||||
|
||||
std::wstring dimension_;
|
||||
|
||||
@ -256,6 +256,7 @@ void chart_axis_attlist::add_attributes( const xml::attributes_wc_ptr & Attribut
|
||||
{
|
||||
CP_APPLY_ATTR(L"chart:dimension", chart_dimension_);
|
||||
CP_APPLY_ATTR(L"chart:name", chart_name_);
|
||||
CP_APPLY_ATTR(L"chartooo:axis-type", axis_type_);
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
#include "../../DataTypes/common_attlists.h"
|
||||
#include "../../DataTypes/charttimeunit.h"
|
||||
#include "../../DataTypes/chartclass.h"
|
||||
#include "../../DataTypes/chartaxistype.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
@ -275,8 +276,7 @@ public:
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::length) svg_width_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
class chart_wall : public office_element_impl<chart_wall>
|
||||
@ -314,10 +314,9 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
common_chart_attlist common_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_floor);
|
||||
|
||||
class chart_axis_attlist
|
||||
@ -325,10 +324,11 @@ class chart_axis_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) chart_dimension_;
|
||||
_CP_OPT(std::wstring) chart_name_;
|
||||
common_chart_attlist common_attlist_;
|
||||
_CP_OPT(std::wstring) chart_dimension_;
|
||||
_CP_OPT(std::wstring) chart_name_;
|
||||
_CP_OPT(odf_types::chart_axis_type) axis_type_;
|
||||
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
// chart:axis
|
||||
@ -348,9 +348,7 @@ private:
|
||||
public:
|
||||
chart_axis_attlist attlist_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_axis);
|
||||
|
||||
class chart_grid_attlist
|
||||
|
||||
Reference in New Issue
Block a user