minor cleanup

This commit is contained in:
Thomas Fussell 2017-02-18 20:33:59 -06:00
parent c01af37da3
commit 4ed8dae49c
8 changed files with 69 additions and 32 deletions

View File

@ -192,12 +192,22 @@ public:
/// <summary>
///
/// </summary>
bool pivot_button_applied() const;
bool pivot_button() const;
/// <summary>
///
/// </summary>
bool quote_prefix_applied() const;
void pivot_button(bool show);
/// <summary>
///
/// </summary>
bool quote_prefix() const;
/// <summary>
///
/// </summary>
void quote_prefix(bool quote);
// Style

View File

@ -230,12 +230,22 @@ public:
/// <summary>
///
/// </summary>
bool pivot_button_applied() const;
bool pivot_button() const;
/// <summary>
///
/// </summary>
bool quote_prefix_applied() const;
void pivot_button(bool show);
/// <summary>
///
/// </summary>
bool quote_prefix() const;
/// <summary>
///
/// </summary>
void quote_prefix(bool quote);
/// <summary>
///

View File

@ -47,9 +47,8 @@ struct format_impl
optional<std::size_t> protection_id;
bool protection_applied = false;
bool pivot_button_applied = false;
bool quote_prefix_applied = false;
bool pivot_button_ = false;
bool quote_prefix_ = false;
optional<std::string> style;

View File

@ -49,9 +49,8 @@ struct style_impl
optional<std::size_t> protection_id;
bool protection_applied = false;
bool pivot_button_applied = false;
bool quote_prefix_applied = false;
bool pivot_button_ = false;
bool quote_prefix_ = false;
};
} // namespace detail

View File

@ -1521,12 +1521,9 @@ void xlsx_consumer::read_stylesheet()
record.first.protection_applied = apply_protection_present
&& is_true(parser().attribute("applyProtection"));
auto pivot_button_present = parser().attribute_present("pivotButton");
record.first.pivot_button_applied = pivot_button_present
record.first.pivot_button_ = parser().attribute_present("pivotButton")
&& is_true(parser().attribute("pivotButton"));
auto quote_prefix_present = parser().attribute_present("quotePrefix");
record.first.quote_prefix_applied = quote_prefix_present
record.first.quote_prefix_ = parser().attribute_present("quotePrefix")
&& is_true(parser().attribute("quotePrefix"));
if (parser().attribute_present("xfId") && parser().name() == "cellXfs")
@ -1743,8 +1740,8 @@ void xlsx_consumer::read_stylesheet()
new_format.number_format_applied = record.first.number_format_applied;
new_format.protection_id = record.first.protection_id;
new_format.protection_applied = record.first.protection_applied;
new_format.pivot_button_applied = record.first.pivot_button_applied;
new_format.quote_prefix_applied = record.first.quote_prefix_applied;
new_format.pivot_button_ = record.first.pivot_button_;
new_format.quote_prefix_ = record.first.quote_prefix_;
}
}
@ -2473,7 +2470,7 @@ void xlsx_consumer::read_comments(worksheet ws)
expect_start_element(qn("spreadsheetml", "comment"), xml::content::complex);
skip_attribute("shapeId");
auto cell_ref = parser().attribute("ref");
auto cell_ref = parser().attribute("ref");
auto author_id = parser().attribute<std::size_t>("authorId");
expect_start_element(qn("spreadsheetml", "text"), xml::content::complex);
@ -2755,12 +2752,12 @@ rich_text xlsx_consumer::read_rich_text(const xml::qname &parent)
else if (current_run_property_element == xml::qname(xmlns, "b"))
{
run.second.get().bold(parser().attribute_present("val")
? is_true(parser().attribute("val")) : true);
? is_true(parser().attribute("val")) : true);
}
else if (current_run_property_element == xml::qname(xmlns, "i"))
{
run.second.get().italic(parser().attribute_present("val")
? is_true(parser().attribute("val")) : true);
? is_true(parser().attribute("val")) : true);
}
else if (current_run_property_element == xml::qname(xmlns, "u"))
{

View File

@ -1175,12 +1175,12 @@ void xlsx_producer::write_styles(const relationship & /*rel*/)
write_attribute("applyProtection", write_bool(true));
}
if (current_style_impl.pivot_button_applied)
if (current_style_impl.pivot_button_)
{
write_attribute("pivotButton", write_bool(true));
}
if (current_style_impl.quote_prefix_applied)
if (current_style_impl.quote_prefix_)
{
write_attribute("quotePrefix", write_bool(true));
}
@ -1293,12 +1293,12 @@ void xlsx_producer::write_styles(const relationship & /*rel*/)
write_attribute("applyProtection", write_bool(true));
}
if (current_format_impl.pivot_button_applied)
if (current_format_impl.pivot_button_)
{
write_attribute("pivotButton", write_bool(true));
}
if (current_format_impl.quote_prefix_applied)
if (current_format_impl.quote_prefix_)
{
write_attribute("quotePrefix", write_bool(true));
}

View File

@ -210,14 +210,26 @@ bool format::protection_applied() const
{
return d_->protection_applied;
}
bool format::pivot_button_applied() const
bool format::pivot_button() const
{
return d_->pivot_button_applied;
return d_->pivot_button_;
}
bool format::quote_prefix_applied() const
void format::pivot_button(bool show)
{
return d_->quote_prefix_applied;
d_->pivot_button_ = show;
}
bool format::quote_prefix() const
{
return d_->quote_prefix_;
}
void format::quote_prefix(bool quote)
{
d_->quote_prefix_ = quote;
}
} // namespace xlnt

View File

@ -238,14 +238,24 @@ bool style::protection_applied() const
return d_->protection_applied;
}
bool style::pivot_button_applied() const
bool style::pivot_button() const
{
return d_->pivot_button_applied;
return d_->pivot_button_;
}
bool style::quote_prefix_applied() const
void style::pivot_button(bool show)
{
return d_->quote_prefix_applied;
d_->pivot_button_ = show;
}
bool style::quote_prefix() const
{
return d_->quote_prefix_;
}
void style::quote_prefix(bool quote)
{
d_->quote_prefix_ = quote;
}
} // namespace xlnt