translate theme to libstudxml, ugh...

This commit is contained in:
Thomas Fussell 2016-09-18 21:49:37 -04:00
parent a81a0a6dde
commit 941bd2a672
3 changed files with 794 additions and 546 deletions

File diff suppressed because it is too large Load Diff

View File

@ -118,7 +118,7 @@ private:
std::string write_bool(bool boolean) const; std::string write_bool(bool boolean) const;
void write_relationships(const std::vector<xlnt::relationship> &relationships, const path &part); void write_relationships(const std::vector<xlnt::relationship> &relationships, const path &part);
bool write_color(const xlnt::color &color); void write_color(const xlnt::color &color);
void write_dxfs(); void write_dxfs();
void write_table_styles(); void write_table_styles();
void write_colors(const std::vector<xlnt::color> &colors); void write_colors(const std::vector<xlnt::color> &colors);

View File

@ -422,8 +422,12 @@ public:
{ {
std::string attribute_name(left_attribute.name()); std::string attribute_name(left_attribute.name());
auto right_attribute = right.attribute(attribute_name.c_str()); auto right_attribute = right.attribute(attribute_name.c_str());
// pugixml doesn't handle namespaces correctly
bool special_exception = left_name == "mc:AlternateContent"
&& attribute_name == "xmlns:mc";
if(!right_attribute) if(!right_attribute && !special_exception)
{ {
return {difference_type::missing_attribute, attribute_name, "((empty))"}; return {difference_type::missing_attribute, attribute_name, "((empty))"};
} }
@ -431,7 +435,7 @@ public:
std::string left_attribute_value(left_attribute.value()); std::string left_attribute_value(left_attribute.value());
std::string right_attribute_value(right_attribute.value()); std::string right_attribute_value(right_attribute.value());
if(left_attribute_value != right_attribute_value) if(left_attribute_value != right_attribute_value && !special_exception)
{ {
return {difference_type::attribute_values_differ, left_attribute_value, right_attribute_value}; return {difference_type::attribute_values_differ, left_attribute_value, right_attribute_value};
} }
@ -442,7 +446,11 @@ public:
std::string attribute_name(right_attribute.name()); std::string attribute_name(right_attribute.name());
auto left_attribute = left.attribute(attribute_name.c_str()); auto left_attribute = left.attribute(attribute_name.c_str());
if(!left_attribute) // pugixml doesn't handle namespaces correctly
bool special_exception = left_name == "mc:AlternateContent"
&& attribute_name == "xmlns:mc";
if(!left_attribute && !special_exception)
{ {
return {difference_type::missing_attribute, "((empty))", attribute_name}; return {difference_type::missing_attribute, "((empty))", attribute_name};
} }
@ -450,7 +458,7 @@ public:
std::string left_attribute_value(left_attribute.value()); std::string left_attribute_value(left_attribute.value());
std::string right_attribute_value(right_attribute.value()); std::string right_attribute_value(right_attribute.value());
if(left_attribute_value != right_attribute_value) if(left_attribute_value != right_attribute_value && !special_exception)
{ {
return {difference_type::attribute_values_differ, left_attribute_value, right_attribute_value}; return {difference_type::attribute_values_differ, left_attribute_value, right_attribute_value};
} }