mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-19 22:01:45 +08:00
OdfFormatWriter - extendede condition conditional formatting (x14)
This commit is contained in:
@ -58,6 +58,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va
|
||||
break;
|
||||
case calcext_type::Minimum:
|
||||
_Wostream << L"minimum";
|
||||
break;
|
||||
case calcext_type::Percentile:
|
||||
_Wostream << L"percentile";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str)
|
||||
return calcext_type( Minimum );
|
||||
else if (tmp == L"formula")
|
||||
return calcext_type( Formula );
|
||||
else if (tmp == L"percentile")
|
||||
return calcext_type( Percentile );
|
||||
else
|
||||
{
|
||||
return calcext_type( Number );
|
||||
|
||||
@ -49,7 +49,8 @@ public:
|
||||
Minimum,
|
||||
AutoMaximum,
|
||||
AutoMinimum,
|
||||
Formula
|
||||
Formula,
|
||||
Percentile
|
||||
};
|
||||
|
||||
calcext_type() {}
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="
Rpcrt4.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
|
||||
@ -140,7 +140,7 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -170,6 +170,7 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
if (!content_[i]) continue;
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
@ -194,7 +195,7 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -206,8 +207,8 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
|
||||
|
||||
// calcext_formatting_entry
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_formatting_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
|
||||
const wchar_t * calcext_formatting_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
|
||||
|
||||
void calcext_formatting_entry::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -223,8 +224,8 @@ void calcext_formatting_entry::serialize(std::wostream & _Wostream)
|
||||
|
||||
// calcext_color_scale_entry
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_color_scale_entry::name = L"color_scale_entry";
|
||||
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_color_scale_entry::name = L"color-scale-entry";
|
||||
|
||||
void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -240,7 +241,7 @@ void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
|
||||
}
|
||||
// calcext_condition
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_condition::ns = L"calcext";
|
||||
const wchar_t * calcext_condition::ns = L"calcext";
|
||||
const wchar_t * calcext_condition::name = L"condition";
|
||||
|
||||
void calcext_condition::serialize(std::wostream & _Wostream)
|
||||
@ -249,7 +250,7 @@ void calcext_condition::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_condition_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +265,7 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_date_is_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// \brief calcext:color-scale-entry
|
||||
/// calcext:color-scale-entry
|
||||
class calcext_color_scale_entry : public office_element_impl<calcext_color_scale_entry>
|
||||
{
|
||||
public:
|
||||
@ -104,13 +104,13 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(odf_types::color) calcext_color_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale_entry);
|
||||
|
||||
/// \brief calcext:formatting-entry
|
||||
/// calcext:formatting-entry
|
||||
class calcext_formatting_entry : public office_element_impl<calcext_formatting_entry>
|
||||
{
|
||||
public:
|
||||
@ -125,13 +125,13 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_formatting_entry);
|
||||
|
||||
/// \brief calcext:icon-set
|
||||
/// calcext:icon-set
|
||||
class calcext_icon_set : public office_element_impl<calcext_icon_set>
|
||||
{
|
||||
public:
|
||||
@ -146,15 +146,13 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_icon_set_attr calcext_icon_set_attr_;
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//entries
|
||||
calcext_icon_set_attr attr_;
|
||||
office_element_ptr_array content_;//entries
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_icon_set);
|
||||
|
||||
/// \brief calcext:data-bar
|
||||
/// calcext:data-bar
|
||||
class calcext_data_bar: public office_element_impl<calcext_data_bar>
|
||||
{
|
||||
public:
|
||||
@ -169,14 +167,12 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_data_bar_attr calcext_data_bar_attr_;
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//entries
|
||||
calcext_data_bar_attr attr_;
|
||||
office_element_ptr_array content_;//entries
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar)
|
||||
|
||||
/// \brief calcext:color-scale
|
||||
/// calcext:color-scale
|
||||
class calcext_color_scale: public office_element_impl<calcext_color_scale>
|
||||
{
|
||||
public:
|
||||
@ -191,12 +187,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//color_scale_entries
|
||||
office_element_ptr_array content_; //color_scale_entries
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale)
|
||||
|
||||
/// \brief calcext:date-is
|
||||
/// calcext:date-is
|
||||
class calcext_date_is: public office_element_impl<calcext_date_is>
|
||||
{
|
||||
public:
|
||||
@ -211,11 +206,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_date_is_attr calcext_date_is_attr_;
|
||||
calcext_date_is_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is)
|
||||
|
||||
/// \brief calcext:condition
|
||||
/// calcext:condition
|
||||
class calcext_condition: public office_element_impl<calcext_condition>
|
||||
{
|
||||
public:
|
||||
@ -230,11 +225,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_condition_attr calcext_condition_attr_;
|
||||
calcext_condition_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition)
|
||||
|
||||
/// \brief calcext:conditional-format
|
||||
/// calcext:conditional-format
|
||||
class calcext_conditional_format: public office_element_impl<calcext_conditional_format>
|
||||
{
|
||||
public:
|
||||
@ -257,7 +252,7 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_format)
|
||||
|
||||
/// \brief calcext:conditional-formats
|
||||
/// calcext:conditional-formats
|
||||
class calcext_conditional_formats: public office_element_impl<calcext_conditional_formats>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -1137,20 +1137,20 @@ void ods_table_state::start_conditional_rule(int rule_type)
|
||||
boost::algorithm::split(splitted, test, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
cell = splitted[0];
|
||||
|
||||
condition->calcext_condition_attr_.calcext_base_cell_address_ = table + cell;
|
||||
condition->attr_.calcext_base_cell_address_ = table + cell;
|
||||
}
|
||||
switch(rule_type)
|
||||
{
|
||||
case 4: condition->calcext_condition_attr_.calcext_value_ = L"contains-text( )"; break;
|
||||
case 5: condition->calcext_condition_attr_.calcext_value_ = L"is-error"; break;
|
||||
case 6: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 8: condition->calcext_condition_attr_.calcext_value_ = L"duplicate"; break;
|
||||
case 9: condition->calcext_condition_attr_.calcext_value_ = L"formula-is()"; break;
|
||||
case 11: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text( )"; break;
|
||||
case 12: condition->calcext_condition_attr_.calcext_value_ = L"is-no-error"; break;
|
||||
case 13: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 15: condition->calcext_condition_attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
|
||||
case 16: condition->calcext_condition_attr_.calcext_value_ = L"unique"; break;
|
||||
case 4: condition->attr_.calcext_value_ = L"contains-text( )"; break;
|
||||
case 5: condition->attr_.calcext_value_ = L"is-error"; break;
|
||||
case 6: condition->attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 8: condition->attr_.calcext_value_ = L"duplicate"; break;
|
||||
case 9: condition->attr_.calcext_value_ = L"formula-is()"; break;
|
||||
case 11: condition->attr_.calcext_value_ = L"not-contains-text( )"; break;
|
||||
case 12: condition->attr_.calcext_value_ = L"is-no-error"; break;
|
||||
case 13: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 15: condition->attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
|
||||
case 16: condition->attr_.calcext_value_ = L"unique"; break;
|
||||
case 0: /*aboveAverage*/
|
||||
case 1: /*beginsWith*/
|
||||
case 2: /*cellIs*/
|
||||
@ -1178,9 +1178,9 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
|
||||
|
||||
std::wstring operator_;
|
||||
bool s = false;
|
||||
if (condition->calcext_condition_attr_.calcext_value_)//есть опреатор
|
||||
if (condition->attr_.calcext_value_)//есть опреатор
|
||||
{
|
||||
operator_ = *condition->calcext_condition_attr_.calcext_value_;
|
||||
operator_ = *condition->attr_.calcext_value_;
|
||||
int f = operator_.find(L"(");
|
||||
if (f > 0)
|
||||
{
|
||||
@ -1188,7 +1188,7 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
|
||||
operator_ = operator_.substr(0,operator_.length() - 2);
|
||||
}
|
||||
}
|
||||
condition->calcext_condition_attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
|
||||
condition->attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
|
||||
}
|
||||
}
|
||||
void ods_table_state::set_conditional_style_name(std::wstring style_name)
|
||||
@ -1196,8 +1196,8 @@ void ods_table_state::set_conditional_style_name(std::wstring style_name)
|
||||
calcext_condition* condition = dynamic_cast<calcext_condition*> (current_level_.back().get());
|
||||
calcext_date_is* date_is = dynamic_cast<calcext_date_is*> (current_level_.back().get());
|
||||
|
||||
if (condition) condition->calcext_condition_attr_.calcext_apply_style_name_= style_name;
|
||||
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_name;
|
||||
if (condition) condition->attr_.calcext_apply_style_name_ = style_name;
|
||||
if (date_is) date_is->attr_.calcext_style_ = style_name;
|
||||
}
|
||||
void ods_table_state::set_conditional_operator(int _operator)
|
||||
{
|
||||
@ -1206,18 +1206,18 @@ void ods_table_state::set_conditional_operator(int _operator)
|
||||
{
|
||||
switch(_operator)
|
||||
{
|
||||
case 0: condition->calcext_condition_attr_.calcext_value_ = L"begins-with()"; break;
|
||||
case 1: condition->calcext_condition_attr_.calcext_value_ = L"between()"; break;
|
||||
case 2: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 3: condition->calcext_condition_attr_.calcext_value_ = L"ends-with()"; break;
|
||||
case 4: condition->calcext_condition_attr_.calcext_value_ = L"="; break;
|
||||
case 5: condition->calcext_condition_attr_.calcext_value_ = L">"; break;
|
||||
case 6: condition->calcext_condition_attr_.calcext_value_ = L">="; break;
|
||||
case 7: condition->calcext_condition_attr_.calcext_value_ = L"<"; break;
|
||||
case 8: condition->calcext_condition_attr_.calcext_value_ = L"<="; break;
|
||||
case 9: condition->calcext_condition_attr_.calcext_value_ = L"not-between()"; break;
|
||||
case 10:condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 11:condition->calcext_condition_attr_.calcext_value_ = L"!="; break;
|
||||
case 0: condition->attr_.calcext_value_ = L"begins-with()"; break;
|
||||
case 1: condition->attr_.calcext_value_ = L"between()"; break;
|
||||
case 2: condition->attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 3: condition->attr_.calcext_value_ = L"ends-with()"; break;
|
||||
case 4: condition->attr_.calcext_value_ = L"="; break;
|
||||
case 5: condition->attr_.calcext_value_ = L">"; break;
|
||||
case 6: condition->attr_.calcext_value_ = L">="; break;
|
||||
case 7: condition->attr_.calcext_value_ = L"<"; break;
|
||||
case 8: condition->attr_.calcext_value_ = L"<="; break;
|
||||
case 9: condition->attr_.calcext_value_ = L"not-between()"; break;
|
||||
case 10:condition->attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 11:condition->attr_.calcext_value_ = L"!="; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1229,8 +1229,8 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
|
||||
if (icon_set || data_bar)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"formatting-entry",elm, context_);
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"formatting-entry", elm, context_);
|
||||
|
||||
current_level_.back()->add_child_element(elm);
|
||||
|
||||
@ -1247,13 +1247,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
case 3: //Number
|
||||
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
|
||||
}
|
||||
entry->calcext_value_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (color_scale)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"color-scale-entry",elm, context_);
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"color-scale-entry", elm, context_);
|
||||
|
||||
current_level_.back()->add_child_element(elm);
|
||||
|
||||
@ -1263,13 +1264,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
switch(type)
|
||||
{
|
||||
case 0: //Formula
|
||||
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
|
||||
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
|
||||
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
|
||||
case 5: //Percentile
|
||||
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
|
||||
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
|
||||
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
|
||||
case 5: entry->calcext_type_ = calcext_type(calcext_type::Percentile); break;
|
||||
case 3: //Number
|
||||
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
|
||||
}
|
||||
entry->calcext_value_ = value;
|
||||
}
|
||||
///color???? - прихоодят выше уровнем !!
|
||||
}
|
||||
@ -1281,11 +1283,22 @@ void ods_table_state::set_conditional_iconset(int type_iconset)
|
||||
|
||||
if (cond_format)
|
||||
{
|
||||
cond_format->calcext_icon_set_attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
|
||||
cond_format->attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
|
||||
}
|
||||
}
|
||||
void ods_table_state::add_conditional_colorscale(_CP_OPT(color) color)
|
||||
void ods_table_state::add_conditional_colorscale(int index, _CP_OPT(color) color)
|
||||
{
|
||||
calcext_color_scale *scale = dynamic_cast<calcext_color_scale*>(current_level_.back().get());
|
||||
|
||||
if (!scale) return;
|
||||
if (index >= scale->content_.size() || index < 0) return;
|
||||
|
||||
calcext_color_scale_entry* color_scale_entry = dynamic_cast<calcext_color_scale_entry*>(scale->content_[index].get());
|
||||
|
||||
if (color_scale_entry)
|
||||
{
|
||||
color_scale_entry->calcext_color_ = color;
|
||||
}
|
||||
}
|
||||
void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
|
||||
{
|
||||
@ -1293,7 +1306,7 @@ void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
|
||||
|
||||
if (cond_format)
|
||||
{
|
||||
cond_format->calcext_data_bar_attr_.calcext_positive_color_ = color;
|
||||
cond_format->attr_.calcext_positive_color_ = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ public:
|
||||
void set_conditional_formula(std::wstring formula);
|
||||
void set_conditional_value(int type, std::wstring value );
|
||||
void set_conditional_iconset(int type_iconset);
|
||||
void add_conditional_colorscale(_CP_OPT(odf_types::color) color);
|
||||
void add_conditional_colorscale(int index, _CP_OPT(odf_types::color) color);
|
||||
void set_conditional_databar_color(_CP_OPT(odf_types::color) color);
|
||||
|
||||
void set_conditional_style_name(std::wstring style_name);
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
/// \brief office:chart
|
||||
/// office:chart
|
||||
class office_chart : public office_element_impl<office_chart>
|
||||
{
|
||||
public:
|
||||
@ -86,7 +86,7 @@ public:
|
||||
_CP_OPT(std::wstring) chart_row_mapping_;
|
||||
};
|
||||
|
||||
/// \brief chart:chart
|
||||
/// chart:chart
|
||||
class chart_chart : public office_element_impl<chart_chart>
|
||||
{
|
||||
public:
|
||||
@ -118,7 +118,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:title
|
||||
/// chart:title
|
||||
class chart_title : public office_element_impl<chart_title>
|
||||
{
|
||||
public:
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_title);
|
||||
|
||||
/// \brief chart:subtitle
|
||||
/// chart:subtitle
|
||||
class chart_subtitle : public office_element_impl<chart_subtitle>
|
||||
{
|
||||
public:
|
||||
@ -161,7 +161,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_subtitle);
|
||||
|
||||
/// \brief chart:footer
|
||||
/// chart:footer
|
||||
class chart_footer : public office_element_impl<chart_footer>
|
||||
{
|
||||
public:
|
||||
@ -200,7 +200,7 @@ public:
|
||||
_CP_OPT(odf_types::length) chartooo_width_;
|
||||
};
|
||||
|
||||
/// \brief chart:legend
|
||||
/// chart:legend
|
||||
class chart_legend : public office_element_impl<chart_legend>
|
||||
{
|
||||
public:
|
||||
@ -239,7 +239,7 @@ public:
|
||||
// common-dr3d-transform-attlist
|
||||
};
|
||||
|
||||
/// \brief chart:plot-area
|
||||
/// chart:plot-area
|
||||
class chart_plot_area : public office_element_impl<chart_plot_area>
|
||||
{
|
||||
public:
|
||||
@ -291,7 +291,7 @@ public:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_wall);
|
||||
|
||||
|
||||
/// \brief chart:floor
|
||||
/// chart:floor
|
||||
class chart_floor : public office_element_impl<chart_floor>
|
||||
{
|
||||
public:
|
||||
@ -322,7 +322,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:axis
|
||||
/// chart:axis
|
||||
class chart_axis : public office_element_impl<chart_axis>
|
||||
{
|
||||
public:
|
||||
@ -354,7 +354,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/// \brief chart:grid
|
||||
/// chart:grid
|
||||
class chart_grid : public office_element_impl<chart_grid>
|
||||
{
|
||||
public:
|
||||
@ -375,7 +375,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_grid);
|
||||
|
||||
/// \brief chart:categories
|
||||
/// chart:categories
|
||||
class chart_categories : public office_element_impl<chart_categories>
|
||||
{
|
||||
public:
|
||||
@ -409,7 +409,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/// \brief chart:series
|
||||
/// chart:series
|
||||
class chart_series : public office_element_impl<chart_series>
|
||||
{
|
||||
public:
|
||||
@ -431,7 +431,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_series);
|
||||
|
||||
/// \brief chart:domain
|
||||
/// chart:domain
|
||||
class chart_domain : public office_element_impl<chart_domain>
|
||||
{
|
||||
public:
|
||||
@ -461,7 +461,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:data-point
|
||||
/// chart:data-point
|
||||
class chart_data_point : public office_element_impl<chart_data_point>
|
||||
{
|
||||
public:
|
||||
@ -482,7 +482,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_data_point);
|
||||
|
||||
/// \brief chart:mean-value
|
||||
/// chart:mean-value
|
||||
class chart_mean_value : public office_element_impl<chart_mean_value>
|
||||
{
|
||||
public:
|
||||
@ -503,7 +503,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_mean_value);
|
||||
|
||||
/// \brief chart:error-indicator
|
||||
/// chart:error-indicator
|
||||
class chart_error_indicator : public office_element_impl<chart_error_indicator>
|
||||
{
|
||||
public:
|
||||
@ -566,7 +566,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_regression_curve);
|
||||
|
||||
/// \brief chart:stock-gain-marker
|
||||
/// chart:stock-gain-marker
|
||||
class chart_stock_gain_marker : public office_element_impl<chart_stock_gain_marker>
|
||||
{
|
||||
public:
|
||||
@ -587,7 +587,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_gain_marker);
|
||||
|
||||
/// \brief chart:stock-loss-marker
|
||||
/// chart:stock-loss-marker
|
||||
class chart_stock_loss_marker : public office_element_impl<chart_stock_loss_marker>
|
||||
{
|
||||
public:
|
||||
@ -608,7 +608,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_loss_marker);
|
||||
|
||||
/// \brief chart:stock-range-line
|
||||
/// chart:stock-range-line
|
||||
class chart_stock_range_line : public office_element_impl<chart_stock_range_line>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "XlsxConverter.h"
|
||||
#include "PptxConverter.h"
|
||||
#include "DocxConverter.h"
|
||||
|
||||
@ -664,6 +665,8 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
if (effectLst) convert(effectLst);
|
||||
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
|
||||
|
||||
//convert(oox_spPr->ExtLst.GetPointer());
|
||||
|
||||
//nullable<OOX::Drawing::CEffectContainer> EffectDag;
|
||||
|
||||
//nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst;
|
||||
@ -672,6 +675,40 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
void OoxConverter::convert(OOX::Drawing::COfficeArtExtensionList *ext_list)
|
||||
{
|
||||
if (ext_list == NULL)return;
|
||||
|
||||
for (size_t i = 0; i < ext_list->m_arrExt.size(); i++)
|
||||
{
|
||||
convert(ext_list->m_arrExt[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void OoxConverter::convert(OOX::Drawing::COfficeArtExtension *art_ext)
|
||||
{
|
||||
if (art_ext == NULL)return;
|
||||
|
||||
if (art_ext->m_oSparklineGroups.IsInit() || art_ext->m_oAltTextTable.IsInit() || !art_ext->m_arrConditionalFormatting.empty())
|
||||
{
|
||||
XlsxConverter *xlsx_converter = dynamic_cast<XlsxConverter*>(this);
|
||||
if (xlsx_converter)
|
||||
{
|
||||
xlsx_converter->convert(art_ext->m_oSparklineGroups.GetPointer());
|
||||
xlsx_converter->convert(art_ext->m_oAltTextTable.GetPointer());
|
||||
|
||||
for (size_t i = 0; i < art_ext->m_arrConditionalFormatting.size(); i++)
|
||||
{
|
||||
xlsx_converter->convert(art_ext->m_arrConditionalFormatting[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//convert(art_ext->m_oCompatExt.GetPointer());
|
||||
//convert(art_ext->m_oDataModelExt.GetPointer());
|
||||
}
|
||||
|
||||
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
|
||||
{
|
||||
if (oox_fill == NULL) return;
|
||||
|
||||
@ -58,6 +58,8 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/sparkline.h"
|
||||
|
||||
#define PROGRESSEVENT_ID 0
|
||||
|
||||
namespace Oox2Odf
|
||||
@ -285,6 +287,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_extLst:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Drawing::COfficeArtExtensionList*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ext:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Drawing::COfficeArtExtension*>(oox_unknown));
|
||||
}break;
|
||||
// "ненужные" элементы
|
||||
case OOX::et_w_softHyphen:
|
||||
case OOX::et_w_proofErr:
|
||||
|
||||
@ -78,6 +78,8 @@ namespace OOX
|
||||
//class CPresetTextShape;
|
||||
class CInline;
|
||||
class CAnchor;
|
||||
class COfficeArtExtensionList;
|
||||
class COfficeArtExtension;
|
||||
}
|
||||
namespace Spreadsheet
|
||||
{
|
||||
@ -520,6 +522,9 @@ public:
|
||||
void convert(OOX::Vml::CGroup *vml_group);
|
||||
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
|
||||
void convert(OOX::Vml::CFormulas *vml_formulas);
|
||||
|
||||
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
|
||||
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
|
||||
};
|
||||
|
||||
} // namespace Oox2Odf
|
||||
|
||||
@ -363,6 +363,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
convert(oox_sheet->m_oPageSetup.GetPointer());
|
||||
convert(oox_sheet->m_oPageMargins.GetPointer());
|
||||
convert(oox_sheet->m_oPicture.GetPointer());
|
||||
|
||||
OoxConverter::convert(oox_sheet->m_oExtLst.GetPointer());
|
||||
|
||||
xlsx_current_container = old_container;
|
||||
}
|
||||
@ -422,8 +424,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
|
||||
if (oox_table_part->m_oAutoFilter.IsInit())
|
||||
ods_context->set_table_part_autofilter(true);
|
||||
|
||||
OoxConverter::convert(oox_table_part->m_oExtLst.GetPointer());
|
||||
|
||||
ods_context->end_table_part();
|
||||
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
|
||||
@ -633,14 +636,24 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
|
||||
OOX::Spreadsheet::CDataBar *pB = dynamic_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown);
|
||||
convert(pB);
|
||||
}break;
|
||||
case OOX::et_x_ColorScale:
|
||||
{
|
||||
OOX::Spreadsheet::CColorScale *pB = dynamic_cast<OOX::Spreadsheet::CColorScale*>(oox_unknown);
|
||||
convert(pB);
|
||||
}break;
|
||||
case OOX::et_x_FormulaCF:
|
||||
{
|
||||
OOX::Spreadsheet::CFormulaCF *pF = dynamic_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown);
|
||||
convert(pF);
|
||||
}break;
|
||||
case OOX::et_x_ConditionalFormatValueObject:
|
||||
{
|
||||
OOX::Spreadsheet::CConditionalFormatValueObject *pF = dynamic_cast<OOX::Spreadsheet::CConditionalFormatValueObject*>(oox_unknown);
|
||||
convert(pF);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
_CP_LOG << L"[warning] : no convert element(" << oox_unknown->getType() << L")\n";
|
||||
OoxConverter::convert(oox_unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2012,6 +2025,15 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
|
||||
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CSparklineGroups *sparkline)
|
||||
{
|
||||
if (!sparkline)return;
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CAltTextTable *alt_text)
|
||||
{
|
||||
if (!alt_text)return;
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
|
||||
{
|
||||
if (!oox_cond_fmt)return;
|
||||
@ -2075,6 +2097,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
|
||||
{
|
||||
if (!oox_cond_colorscale)return;
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
|
||||
it != oox_cond_colorscale->m_arrItems.end(); it++)
|
||||
@ -2091,7 +2115,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
|
||||
_CP_OPT(odf_types::color) color;
|
||||
convert(dynamic_cast<OOX::Spreadsheet::CColor*>(*it), color);
|
||||
|
||||
ods_context->current_table().add_conditional_colorscale( color );
|
||||
ods_context->current_table().add_conditional_colorscale( index++, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2116,12 +2140,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox
|
||||
|
||||
std::wstring val;
|
||||
int type = 3;
|
||||
if (oox_cond_value->m_oVal.IsInit()) val = oox_cond_value->m_oVal.get2();
|
||||
if (oox_cond_value->m_oType.IsInit()) type = oox_cond_value->m_oType->GetValue();
|
||||
|
||||
ods_context->current_table().set_conditional_value(type,val);
|
||||
if (oox_cond_value->m_oFormula.IsInit()) val = oox_cond_value->m_oFormula->m_sText;
|
||||
else if (oox_cond_value->m_oVal.IsInit()) val = oox_cond_value->m_oVal.get2();
|
||||
|
||||
ods_context->current_table().set_conditional_value(type, val);
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula)
|
||||
{
|
||||
if (!oox_cond_formula)return;
|
||||
ods_context->current_table().set_conditional_formula(oox_cond_formula->m_sText);
|
||||
|
||||
@ -89,7 +89,9 @@ namespace OOX
|
||||
class CSi;
|
||||
class CWorkbookView;
|
||||
class CPictureWorksheet;
|
||||
class CHeaderFooter;
|
||||
class CHeaderFooter;
|
||||
class CSparklineGroups;
|
||||
class CAltTextTable;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,6 +128,8 @@ namespace Oox2Odf
|
||||
class XlsxConverter : public OoxConverter
|
||||
{
|
||||
public:
|
||||
friend class OoxConverter;
|
||||
|
||||
XlsxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
|
||||
~XlsxConverter();
|
||||
|
||||
@ -207,6 +211,9 @@ namespace Oox2Odf
|
||||
void convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula);
|
||||
void convert(OOX::Spreadsheet::CSi *oox_rtf_text);
|
||||
|
||||
void convert(OOX::Spreadsheet::CSparklineGroups *sparkline);
|
||||
void convert(OOX::Spreadsheet::CAltTextTable *alt_text);
|
||||
|
||||
void convert(double oox_size, _CP_OPT(odf_types::length) & odf_size);
|
||||
void convert_sharing_string(int number);
|
||||
};
|
||||
|
||||
@ -42,6 +42,50 @@ namespace OOX
|
||||
{
|
||||
//необработано:
|
||||
//<extLst>
|
||||
class CFormulaCF : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CFormulaCF)
|
||||
CFormulaCF()
|
||||
{
|
||||
m_sNodeName = L"formula";
|
||||
}
|
||||
virtual ~CFormulaCF()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<" + m_sNodeName + L">");
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteString(L"</" + m_sNodeName + L">");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
m_sNodeName = oReader.GetName();
|
||||
|
||||
if (oReader.IsEmptyNode())
|
||||
return;
|
||||
|
||||
m_sText = oReader.GetText3();
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_FormulaCF;
|
||||
}
|
||||
|
||||
std::wstring m_sNodeName;
|
||||
std::wstring m_sText;
|
||||
};
|
||||
|
||||
|
||||
class CConditionalFormatValueObject : public WritingElement
|
||||
{
|
||||
public:
|
||||
@ -75,8 +119,16 @@ namespace OOX
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
|
||||
if ( !oReader.IsEmptyNode() )
|
||||
oReader.ReadTillEnd();
|
||||
if (oReader.IsEmptyNode())
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while (oReader.ReadNextSiblingNode(nCurDepth))
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if (L"formula" == sName || L"f" == sName)
|
||||
m_oFormula = oReader;
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
@ -102,6 +154,8 @@ namespace OOX
|
||||
nullable<SimpleTypes::COnOff<>> m_oGte;
|
||||
nullable<SimpleTypes::Spreadsheet::ST_CfvoType<>> m_oType;
|
||||
nullable<std::wstring> m_oVal;
|
||||
|
||||
nullable<CFormulaCF> m_oFormula;
|
||||
};
|
||||
|
||||
class CColorScale : public WritingElementWithChilds<>
|
||||
@ -252,45 +306,6 @@ namespace OOX
|
||||
nullable<CColor> m_oColor;
|
||||
};
|
||||
|
||||
class CFormulaCF : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CFormulaCF)
|
||||
CFormulaCF()
|
||||
{
|
||||
}
|
||||
virtual ~CFormulaCF()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return _T("");
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(_T("<formula>"));
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteString(_T("</formula>"));
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if (oReader.IsEmptyNode())
|
||||
return;
|
||||
|
||||
m_sText = oReader.GetText3();
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_FormulaCF;
|
||||
}
|
||||
|
||||
std::wstring m_sText;
|
||||
};
|
||||
|
||||
class CIconSet : public WritingElementWithChilds<CConditionalFormatValueObject>
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user