Commit adf39680 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - extendede condition conditional formatting (x14)

parent ce77d478
...@@ -59,6 +59,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va ...@@ -59,6 +59,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va
case calcext_type::Minimum: case calcext_type::Minimum:
_Wostream << L"minimum"; _Wostream << L"minimum";
break; break;
case calcext_type::Percentile:
_Wostream << L"percentile";
break;
default: default:
break; break;
} }
...@@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str) ...@@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str)
return calcext_type( Minimum ); return calcext_type( Minimum );
else if (tmp == L"formula") else if (tmp == L"formula")
return calcext_type( Formula ); return calcext_type( Formula );
else if (tmp == L"percentile")
return calcext_type( Percentile );
else else
{ {
return calcext_type( Number ); return calcext_type( Number );
......
...@@ -49,7 +49,8 @@ public: ...@@ -49,7 +49,8 @@ public:
Minimum, Minimum,
AutoMaximum, AutoMaximum,
AutoMinimum, AutoMinimum,
Formula Formula,
Percentile
}; };
calcext_type() {} calcext_type() {}
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib" AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2" LinkIncremental="2"
IgnoreDefaultLibraryNames="" IgnoreDefaultLibraryNames="LIBCMTD.lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="1" SubSystem="1"
TargetMachine="1" TargetMachine="1"
......
...@@ -140,7 +140,7 @@ void calcext_data_bar::serialize(std::wostream & _Wostream) ...@@ -140,7 +140,7 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() 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++) for (size_t i = 0; i < content_.size(); i++)
{ {
...@@ -170,6 +170,7 @@ void calcext_color_scale::serialize(std::wostream & _Wostream) ...@@ -170,6 +170,7 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
{ {
for (size_t i = 0; i < content_.size(); i++) for (size_t i = 0; i < content_.size(); i++)
{ {
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM()); content_[i]->serialize(CP_XML_STREAM());
} }
} }
...@@ -194,7 +195,7 @@ void calcext_icon_set::serialize(std::wostream & _Wostream) ...@@ -194,7 +195,7 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() 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++) for (size_t i = 0; i < content_.size(); i++)
{ {
...@@ -224,7 +225,7 @@ void calcext_formatting_entry::serialize(std::wostream & _Wostream) ...@@ -224,7 +225,7 @@ void calcext_formatting_entry::serialize(std::wostream & _Wostream)
// calcext_color_scale_entry // calcext_color_scale_entry
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale_entry::ns = L"calcext"; 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::name = L"color-scale-entry";
void calcext_color_scale_entry::serialize(std::wostream & _Wostream) void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
{ {
...@@ -249,7 +250,7 @@ void calcext_condition::serialize(std::wostream & _Wostream) ...@@ -249,7 +250,7 @@ void calcext_condition::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() 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) ...@@ -264,7 +265,7 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
calcext_date_is_attr_.serialize(CP_GET_XML_NODE()); attr_.serialize(CP_GET_XML_NODE());
} }
} }
} }
......
...@@ -88,7 +88,7 @@ public: ...@@ -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> class calcext_color_scale_entry : public office_element_impl<calcext_color_scale_entry>
{ {
public: public:
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale_entry); 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> class calcext_formatting_entry : public office_element_impl<calcext_formatting_entry>
{ {
public: public:
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_formatting_entry); 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> class calcext_icon_set : public office_element_impl<calcext_icon_set>
{ {
public: public:
...@@ -146,15 +146,13 @@ public: ...@@ -146,15 +146,13 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
calcext_icon_set_attr calcext_icon_set_attr_; calcext_icon_set_attr attr_;
private:
office_element_ptr_array content_;//entries office_element_ptr_array content_;//entries
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_icon_set); 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> class calcext_data_bar: public office_element_impl<calcext_data_bar>
{ {
public: public:
...@@ -169,14 +167,12 @@ public: ...@@ -169,14 +167,12 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
calcext_data_bar_attr calcext_data_bar_attr_; calcext_data_bar_attr attr_;
private:
office_element_ptr_array content_;//entries office_element_ptr_array content_;//entries
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar) 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> class calcext_color_scale: public office_element_impl<calcext_color_scale>
{ {
public: public:
...@@ -191,12 +187,11 @@ public: ...@@ -191,12 +187,11 @@ public:
virtual void serialize(std::wostream & _Wostream); 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) 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> class calcext_date_is: public office_element_impl<calcext_date_is>
{ {
public: public:
...@@ -211,11 +206,11 @@ public: ...@@ -211,11 +206,11 @@ public:
virtual void serialize(std::wostream & _Wostream); 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) CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is)
/// \brief calcext:condition /// calcext:condition
class calcext_condition: public office_element_impl<calcext_condition> class calcext_condition: public office_element_impl<calcext_condition>
{ {
public: public:
...@@ -230,11 +225,11 @@ public: ...@@ -230,11 +225,11 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
calcext_condition_attr calcext_condition_attr_; calcext_condition_attr attr_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition) CP_REGISTER_OFFICE_ELEMENT2(calcext_condition)
/// \brief calcext:conditional-format /// calcext:conditional-format
class calcext_conditional_format: public office_element_impl<calcext_conditional_format> class calcext_conditional_format: public office_element_impl<calcext_conditional_format>
{ {
public: public:
...@@ -257,7 +252,7 @@ private: ...@@ -257,7 +252,7 @@ private:
}; };
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_format) 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> class calcext_conditional_formats: public office_element_impl<calcext_conditional_formats>
{ {
public: public:
......
...@@ -1137,20 +1137,20 @@ void ods_table_state::start_conditional_rule(int rule_type) ...@@ -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); boost::algorithm::split(splitted, test, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
cell = splitted[0]; cell = splitted[0];
condition->calcext_condition_attr_.calcext_base_cell_address_ = table + cell; condition->attr_.calcext_base_cell_address_ = table + cell;
} }
switch(rule_type) switch(rule_type)
{ {
case 4: condition->calcext_condition_attr_.calcext_value_ = L"contains-text( )"; break; case 4: condition->attr_.calcext_value_ = L"contains-text( )"; break;
case 5: condition->calcext_condition_attr_.calcext_value_ = L"is-error"; break; case 5: condition->attr_.calcext_value_ = L"is-error"; break;
case 6: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break; case 6: condition->attr_.calcext_value_ = L"contains-text()"; break;
case 8: condition->calcext_condition_attr_.calcext_value_ = L"duplicate"; break; case 8: condition->attr_.calcext_value_ = L"duplicate"; break;
case 9: condition->calcext_condition_attr_.calcext_value_ = L"formula-is()"; break; case 9: condition->attr_.calcext_value_ = L"formula-is()"; break;
case 11: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text( )"; break; case 11: condition->attr_.calcext_value_ = L"not-contains-text( )"; break;
case 12: condition->calcext_condition_attr_.calcext_value_ = L"is-no-error"; break; case 12: condition->attr_.calcext_value_ = L"is-no-error"; break;
case 13: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break; case 13: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 15: condition->calcext_condition_attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ??? case 15: condition->attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
case 16: condition->calcext_condition_attr_.calcext_value_ = L"unique"; break; case 16: condition->attr_.calcext_value_ = L"unique"; break;
case 0: /*aboveAverage*/ case 0: /*aboveAverage*/
case 1: /*beginsWith*/ case 1: /*beginsWith*/
case 2: /*cellIs*/ case 2: /*cellIs*/
...@@ -1178,9 +1178,9 @@ void ods_table_state::set_conditional_formula(std::wstring formula) ...@@ -1178,9 +1178,9 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
std::wstring operator_; std::wstring operator_;
bool s = false; 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"("); int f = operator_.find(L"(");
if (f > 0) if (f > 0)
{ {
...@@ -1188,7 +1188,7 @@ void ods_table_state::set_conditional_formula(std::wstring formula) ...@@ -1188,7 +1188,7 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
operator_ = operator_.substr(0,operator_.length() - 2); 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) 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) ...@@ -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_condition* condition = dynamic_cast<calcext_condition*> (current_level_.back().get());
calcext_date_is* date_is = dynamic_cast<calcext_date_is*> (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 (condition) condition->attr_.calcext_apply_style_name_ = style_name;
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_name; if (date_is) date_is->attr_.calcext_style_ = style_name;
} }
void ods_table_state::set_conditional_operator(int _operator) void ods_table_state::set_conditional_operator(int _operator)
{ {
...@@ -1206,18 +1206,18 @@ void ods_table_state::set_conditional_operator(int _operator) ...@@ -1206,18 +1206,18 @@ void ods_table_state::set_conditional_operator(int _operator)
{ {
switch(_operator) switch(_operator)
{ {
case 0: condition->calcext_condition_attr_.calcext_value_ = L"begins-with()"; break; case 0: condition->attr_.calcext_value_ = L"begins-with()"; break;
case 1: condition->calcext_condition_attr_.calcext_value_ = L"between()"; break; case 1: condition->attr_.calcext_value_ = L"between()"; break;
case 2: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break; case 2: condition->attr_.calcext_value_ = L"contains-text()"; break;
case 3: condition->calcext_condition_attr_.calcext_value_ = L"ends-with()"; break; case 3: condition->attr_.calcext_value_ = L"ends-with()"; break;
case 4: condition->calcext_condition_attr_.calcext_value_ = L"="; break; case 4: condition->attr_.calcext_value_ = L"="; break;
case 5: condition->calcext_condition_attr_.calcext_value_ = L">"; break; case 5: condition->attr_.calcext_value_ = L">"; break;
case 6: condition->calcext_condition_attr_.calcext_value_ = L">="; break; case 6: condition->attr_.calcext_value_ = L">="; break;
case 7: condition->calcext_condition_attr_.calcext_value_ = L"<"; break; case 7: condition->attr_.calcext_value_ = L"<"; break;
case 8: condition->calcext_condition_attr_.calcext_value_ = L"<="; break; case 8: condition->attr_.calcext_value_ = L"<="; break;
case 9: condition->calcext_condition_attr_.calcext_value_ = L"not-between()"; break; case 9: condition->attr_.calcext_value_ = L"not-between()"; break;
case 10:condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break; case 10:condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 11:condition->calcext_condition_attr_.calcext_value_ = L"!="; break; case 11:condition->attr_.calcext_value_ = L"!="; break;
} }
} }
} }
...@@ -1230,7 +1230,7 @@ void ods_table_state::set_conditional_value(int type, std::wstring value ) ...@@ -1230,7 +1230,7 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
if (icon_set || data_bar) if (icon_set || data_bar)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"formatting-entry",elm, context_); create_element(L"calcext", L"formatting-entry", elm, context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
...@@ -1247,13 +1247,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value ) ...@@ -1247,13 +1247,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
case 3: //Number case 3: //Number
default: entry->calcext_type_ = calcext_type(calcext_type::Number); default: entry->calcext_type_ = calcext_type(calcext_type::Number);
} }
entry->calcext_value_ = value;
} }
} }
if (color_scale) if (color_scale)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"color-scale-entry",elm, context_); create_element(L"calcext", L"color-scale-entry", elm, context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
...@@ -1266,10 +1267,11 @@ void ods_table_state::set_conditional_value(int type, std::wstring value ) ...@@ -1266,10 +1267,11 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break; case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break; case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break; case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
case 5: //Percentile case 5: entry->calcext_type_ = calcext_type(calcext_type::Percentile); break;
case 3: //Number case 3: //Number
default: entry->calcext_type_ = calcext_type(calcext_type::Number); default: entry->calcext_type_ = calcext_type(calcext_type::Number);
} }
entry->calcext_value_ = value;
} }
///color???? - прихоодят выше уровнем !! ///color???? - прихоодят выше уровнем !!
} }
...@@ -1281,11 +1283,22 @@ void ods_table_state::set_conditional_iconset(int type_iconset) ...@@ -1281,11 +1283,22 @@ void ods_table_state::set_conditional_iconset(int type_iconset)
if (cond_format) 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) 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) ...@@ -1293,7 +1306,7 @@ void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
if (cond_format) 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: ...@@ -274,7 +274,7 @@ public:
void set_conditional_formula(std::wstring formula); void set_conditional_formula(std::wstring formula);
void set_conditional_value(int type, std::wstring value ); void set_conditional_value(int type, std::wstring value );
void set_conditional_iconset(int type_iconset); 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_databar_color(_CP_OPT(odf_types::color) color);
void set_conditional_style_name(std::wstring style_name); void set_conditional_style_name(std::wstring style_name);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf_writer { namespace odf_writer {
/// \brief office:chart /// office:chart
class office_chart : public office_element_impl<office_chart> class office_chart : public office_element_impl<office_chart>
{ {
public: public:
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
_CP_OPT(std::wstring) chart_row_mapping_; _CP_OPT(std::wstring) chart_row_mapping_;
}; };
/// \brief chart:chart /// chart:chart
class chart_chart : public office_element_impl<chart_chart> class chart_chart : public office_element_impl<chart_chart>
{ {
public: public:
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
common_chart_attlist common_attlist_; common_chart_attlist common_attlist_;
}; };
/// \brief chart:title /// chart:title
class chart_title : public office_element_impl<chart_title> class chart_title : public office_element_impl<chart_title>
{ {
public: public:
...@@ -139,7 +139,7 @@ public: ...@@ -139,7 +139,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_title); CP_REGISTER_OFFICE_ELEMENT2(chart_title);
/// \brief chart:subtitle /// chart:subtitle
class chart_subtitle : public office_element_impl<chart_subtitle> class chart_subtitle : public office_element_impl<chart_subtitle>
{ {
public: public:
...@@ -161,7 +161,7 @@ public: ...@@ -161,7 +161,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_subtitle); CP_REGISTER_OFFICE_ELEMENT2(chart_subtitle);
/// \brief chart:footer /// chart:footer
class chart_footer : public office_element_impl<chart_footer> class chart_footer : public office_element_impl<chart_footer>
{ {
public: public:
...@@ -200,7 +200,7 @@ public: ...@@ -200,7 +200,7 @@ public:
_CP_OPT(odf_types::length) chartooo_width_; _CP_OPT(odf_types::length) chartooo_width_;
}; };
/// \brief chart:legend /// chart:legend
class chart_legend : public office_element_impl<chart_legend> class chart_legend : public office_element_impl<chart_legend>
{ {
public: public:
...@@ -239,7 +239,7 @@ public: ...@@ -239,7 +239,7 @@ public:
// common-dr3d-transform-attlist // common-dr3d-transform-attlist
}; };
/// \brief chart:plot-area /// chart:plot-area
class chart_plot_area : public office_element_impl<chart_plot_area> class chart_plot_area : public office_element_impl<chart_plot_area>
{ {
public: public:
...@@ -291,7 +291,7 @@ public: ...@@ -291,7 +291,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_wall); CP_REGISTER_OFFICE_ELEMENT2(chart_wall);
/// \brief chart:floor /// chart:floor
class chart_floor : public office_element_impl<chart_floor> class chart_floor : public office_element_impl<chart_floor>
{ {
public: public:
...@@ -322,7 +322,7 @@ public: ...@@ -322,7 +322,7 @@ public:
common_chart_attlist common_attlist_; common_chart_attlist common_attlist_;
}; };
/// \brief chart:axis /// chart:axis
class chart_axis : public office_element_impl<chart_axis> class chart_axis : public office_element_impl<chart_axis>
{ {
public: public:
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
}; };
/// \brief chart:grid /// chart:grid
class chart_grid : public office_element_impl<chart_grid> class chart_grid : public office_element_impl<chart_grid>
{ {
public: public:
...@@ -375,7 +375,7 @@ public: ...@@ -375,7 +375,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_grid); CP_REGISTER_OFFICE_ELEMENT2(chart_grid);
/// \brief chart:categories /// chart:categories
class chart_categories : public office_element_impl<chart_categories> class chart_categories : public office_element_impl<chart_categories>
{ {
public: public:
...@@ -409,7 +409,7 @@ public: ...@@ -409,7 +409,7 @@ public:
}; };
/// \brief chart:series /// chart:series
class chart_series : public office_element_impl<chart_series> class chart_series : public office_element_impl<chart_series>
{ {
public: public:
...@@ -431,7 +431,7 @@ public: ...@@ -431,7 +431,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_series); CP_REGISTER_OFFICE_ELEMENT2(chart_series);
/// \brief chart:domain /// chart:domain
class chart_domain : public office_element_impl<chart_domain> class chart_domain : public office_element_impl<chart_domain>
{ {
public: public:
...@@ -461,7 +461,7 @@ public: ...@@ -461,7 +461,7 @@ public:
common_chart_attlist common_attlist_; common_chart_attlist common_attlist_;
}; };
/// \brief chart:data-point /// chart:data-point
class chart_data_point : public office_element_impl<chart_data_point> class chart_data_point : public office_element_impl<chart_data_point>
{ {
public: public:
...@@ -482,7 +482,7 @@ public: ...@@ -482,7 +482,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_data_point); 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> class chart_mean_value : public office_element_impl<chart_mean_value>
{ {
public: public:
...@@ -503,7 +503,7 @@ public: ...@@ -503,7 +503,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_mean_value); 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> class chart_error_indicator : public office_element_impl<chart_error_indicator>
{ {
public: public:
...@@ -566,7 +566,7 @@ public: ...@@ -566,7 +566,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_regression_curve); 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> class chart_stock_gain_marker : public office_element_impl<chart_stock_gain_marker>
{ {
public: public:
...@@ -587,7 +587,7 @@ public: ...@@ -587,7 +587,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_gain_marker); 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> class chart_stock_loss_marker : public office_element_impl<chart_stock_loss_marker>
{ {
public: public:
...@@ -608,7 +608,7 @@ public: ...@@ -608,7 +608,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_loss_marker); 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> class chart_stock_range_line : public office_element_impl<chart_stock_range_line>
{ {
public: public:
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include "XlsxConverter.h"
#include "PptxConverter.h" #include "PptxConverter.h"
#include "DocxConverter.h" #include "DocxConverter.h"
...@@ -664,6 +665,8 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -664,6 +665,8 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
if (effectLst) convert(effectLst); if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3); else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
//convert(oox_spPr->ExtLst.GetPointer());
//nullable<OOX::Drawing::CEffectContainer> EffectDag; //nullable<OOX::Drawing::CEffectContainer> EffectDag;
//nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst; //nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst;
...@@ -672,6 +675,40 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -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) void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
{ {
if (oox_fill == NULL) return; if (oox_fill == NULL) return;
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/sparkline.h"
#define PROGRESSEVENT_ID 0 #define PROGRESSEVENT_ID 0
namespace Oox2Odf namespace Oox2Odf
...@@ -285,6 +287,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -285,6 +287,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{ {
convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown)); convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown));
}break; }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_softHyphen:
case OOX::et_w_proofErr: case OOX::et_w_proofErr:
......
...@@ -78,6 +78,8 @@ namespace OOX ...@@ -78,6 +78,8 @@ namespace OOX
//class CPresetTextShape; //class CPresetTextShape;
class CInline; class CInline;
class CAnchor; class CAnchor;
class COfficeArtExtensionList;
class COfficeArtExtension;
} }
namespace Spreadsheet namespace Spreadsheet
{ {
...@@ -520,6 +522,9 @@ public: ...@@ -520,6 +522,9 @@ public:
void convert(OOX::Vml::CGroup *vml_group); void convert(OOX::Vml::CGroup *vml_group);
void convert(OOX::Vml::CVmlCommonElements *vml_attr); void convert(OOX::Vml::CVmlCommonElements *vml_attr);
void convert(OOX::Vml::CFormulas *vml_formulas); void convert(OOX::Vml::CFormulas *vml_formulas);
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
}; };
} // namespace Oox2Odf } // namespace Oox2Odf
...@@ -364,6 +364,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) ...@@ -364,6 +364,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oPageMargins.GetPointer()); convert(oox_sheet->m_oPageMargins.GetPointer());
convert(oox_sheet->m_oPicture.GetPointer()); convert(oox_sheet->m_oPicture.GetPointer());
OoxConverter::convert(oox_sheet->m_oExtLst.GetPointer());
xlsx_current_container = old_container; xlsx_current_container = old_container;
} }
void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooter * oox_header_footer) void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooter * oox_header_footer)
...@@ -422,8 +424,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part) ...@@ -422,8 +424,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
if (oox_table_part->m_oAutoFilter.IsInit()) if (oox_table_part->m_oAutoFilter.IsInit())
ods_context->set_table_part_autofilter(true); ods_context->set_table_part_autofilter(true);
ods_context->end_table_part(); OoxConverter::convert(oox_table_part->m_oExtLst.GetPointer());
ods_context->end_table_part();
} }
void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment) void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
...@@ -633,14 +636,24 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown) ...@@ -633,14 +636,24 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
OOX::Spreadsheet::CDataBar *pB = dynamic_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown); OOX::Spreadsheet::CDataBar *pB = dynamic_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown);
convert(pB); convert(pB);
}break; }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: case OOX::et_x_FormulaCF:
{ {
OOX::Spreadsheet::CFormulaCF *pF = dynamic_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown); OOX::Spreadsheet::CFormulaCF *pF = dynamic_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown);
convert(pF); convert(pF);
}break; }break;
case OOX::et_x_ConditionalFormatValueObject:
{
OOX::Spreadsheet::CConditionalFormatValueObject *pF = dynamic_cast<OOX::Spreadsheet::CConditionalFormatValueObject*>(oox_unknown);
convert(pF);
}break;
default: 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 ...@@ -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 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) void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
{ {
if (!oox_cond_fmt)return; if (!oox_cond_fmt)return;
...@@ -2076,6 +2098,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale) ...@@ -2076,6 +2098,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
{ {
if (!oox_cond_colorscale)return; if (!oox_cond_colorscale)return;
int index = 0;
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin(); for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
it != oox_cond_colorscale->m_arrItems.end(); it++) it != oox_cond_colorscale->m_arrItems.end(); it++)
{ {
...@@ -2091,7 +2115,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale) ...@@ -2091,7 +2115,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
_CP_OPT(odf_types::color) color; _CP_OPT(odf_types::color) color;
convert(dynamic_cast<OOX::Spreadsheet::CColor*>(*it), 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,10 +2140,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox ...@@ -2116,10 +2140,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox
std::wstring val; std::wstring val;
int type = 3; 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(); 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)
{ {
......
...@@ -90,6 +90,8 @@ namespace OOX ...@@ -90,6 +90,8 @@ namespace OOX
class CWorkbookView; class CWorkbookView;
class CPictureWorksheet; class CPictureWorksheet;
class CHeaderFooter; class CHeaderFooter;
class CSparklineGroups;
class CAltTextTable;
} }
} }
...@@ -126,6 +128,8 @@ namespace Oox2Odf ...@@ -126,6 +128,8 @@ namespace Oox2Odf
class XlsxConverter : public OoxConverter class XlsxConverter : public OoxConverter
{ {
public: public:
friend class OoxConverter;
XlsxConverter(const std::wstring & path, const ProgressCallback* ffCallBack); XlsxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
~XlsxConverter(); ~XlsxConverter();
...@@ -207,6 +211,9 @@ namespace Oox2Odf ...@@ -207,6 +211,9 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula); void convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula);
void convert(OOX::Spreadsheet::CSi *oox_rtf_text); 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(double oox_size, _CP_OPT(odf_types::length) & odf_size);
void convert_sharing_string(int number); void convert_sharing_string(int number);
}; };
......
...@@ -42,6 +42,50 @@ namespace OOX ...@@ -42,6 +42,50 @@ namespace OOX
{ {
//необработано: //необработано:
//<extLst> //<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 class CConditionalFormatValueObject : public WritingElement
{ {
public: public:
...@@ -75,8 +119,16 @@ namespace OOX ...@@ -75,8 +119,16 @@ namespace OOX
{ {
ReadAttributes(oReader); ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() ) if (oReader.IsEmptyNode())
oReader.ReadTillEnd(); 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 virtual EElementType getType () const
...@@ -102,6 +154,8 @@ namespace OOX ...@@ -102,6 +154,8 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oGte; nullable<SimpleTypes::COnOff<>> m_oGte;
nullable<SimpleTypes::Spreadsheet::ST_CfvoType<>> m_oType; nullable<SimpleTypes::Spreadsheet::ST_CfvoType<>> m_oType;
nullable<std::wstring> m_oVal; nullable<std::wstring> m_oVal;
nullable<CFormulaCF> m_oFormula;
}; };
class CColorScale : public WritingElementWithChilds<> class CColorScale : public WritingElementWithChilds<>
...@@ -252,45 +306,6 @@ namespace OOX ...@@ -252,45 +306,6 @@ namespace OOX
nullable<CColor> m_oColor; 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> class CIconSet : public WritingElementWithChilds<CConditionalFormatValueObject>
{ {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment