rename some things and fix some formatting

This commit is contained in:
Thomas Fussell 2017-02-10 20:22:38 -08:00
parent 81258f1498
commit 84011553a8
5 changed files with 30 additions and 47 deletions

View File

@ -100,22 +100,22 @@ public:
/// <summary>
///
/// </summary>
font &outlinethrough(bool outlinethrough);
font &outline(bool outline);
/// <summary>
///
/// </summary>
bool outlinethrough() const;
bool outline() const;
/// <summary>
///
/// </summary>
font &shadowthrough(bool shadowthrough);
font &shadow(bool shadow);
/// <summary>
///
/// </summary>
bool shadowthrough() const;
bool shadow() const;
/// <summary>
///
@ -276,12 +276,12 @@ private:
/// <summary>
///
/// </summary>
bool outlinethrough_ = false;
bool outline_ = false;
/// <summary>
///
/// </summary>
bool shadowthrough_ = false;
bool shadow_ = false;
/// <summary>
///
@ -303,7 +303,6 @@ private:
/// </summary>
optional<std::size_t> charset_;
/// <summary>
///
/// </summary>

View File

@ -535,8 +535,8 @@ std::pair<int, int> cell::anchor() const
for (row_t row_index = 1; row_index <= d_->row_ - 1; row_index++)
{
top += worksheet().row_height(row_index);
}
top += worksheet().row_height(row_index);
}
return {static_cast<int>(left), static_cast<int>(top)};
}

View File

@ -1349,22 +1349,22 @@ void xlsx_consumer::read_stylesheet()
{
if (parser().attribute_present("val"))
{
new_font.outlinethrough(is_true(parser().attribute("val")));
new_font.outline(is_true(parser().attribute("val")));
}
else
{
new_font.outlinethrough(true);
new_font.outline(true);
}
}
else if (font_property_element == qn("spreadsheetml", "shadow"))
{
if (parser().attribute_present("val"))
{
new_font.shadowthrough(is_true(parser().attribute("val")));
new_font.shadow(is_true(parser().attribute("val")));
}
else
{
new_font.shadowthrough(true);
new_font.shadow(true);
}
}
else if (font_property_element == qn("spreadsheetml", "i"))
@ -2461,7 +2461,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);
@ -2530,11 +2530,7 @@ variant xlsx_consumer::read_variant()
}
if (element == qn("vt", "bool"))
{
// bool could be "0" or "false"
bool bvalue;
if (text[0] == '0' or text[0] == 'f' or text[0]=='F') bvalue = false;
else bvalue = true;
value = variant(bvalue);
value = variant(is_true(text));
}
else if (element == qn("vt", "vector"))
{
@ -2650,12 +2646,8 @@ std::vector<std::string> xlsx_consumer::read_namespaces()
bool xlsx_consumer::in_element(const xml::qname &name)
{
if ((parser().peek() == xml::parser::event_type::end_element ) && (stack_.back() == name ))
{
return false;
}
return true;
return parser().peek() != xml::parser::event_type::end_element
&& stack_.back() == name;
}
xml::qname xlsx_consumer::expect_start_element(xml::content content)
@ -2750,13 +2742,13 @@ 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);
run.second.get().bold(parser().attribute_present("val")
? is_true(parser().attribute("val")) : true);
}
else if (current_run_property_element == xml::qname(xmlns, "i"))
{
run.second.get().bold(
parser().attribute_present("val") ? is_true(parser().attribute("val")) : true);
run.second.get().italic(parser().attribute_present("val")
? is_true(parser().attribute("val")) : true);
}
else if (current_run_property_element == xml::qname(xmlns, "u"))
{

View File

@ -30,15 +30,7 @@ namespace xlnt {
font::font()
: name_("Calibri"),
size_(12.0),
bold_(false),
italic_(false),
superscript_(false),
subscript_(false),
strikethrough_(false),
outlinethrough_(false),
shadowthrough_(false),
underline_(underline_style::none)
size_(12.0)
{
}
@ -86,26 +78,26 @@ bool font::strikethrough() const
return strikethrough_;
}
font &font::outlinethrough(bool outlinethrough)
font &font::outline(bool outline)
{
outlinethrough_ = outlinethrough;
outline_ = outline;
return *this;
}
bool font::outlinethrough() const
bool font::outline() const
{
return outlinethrough_;
return outline_;
}
font &font::shadowthrough(bool shadowthrough)
font &font::shadow(bool shadow)
{
shadowthrough_ = shadowthrough;
shadow_ = shadow;
return *this;
}
bool font::shadowthrough() const
bool font::shadow() const
{
return shadowthrough_;
return shadow_;
}
font &font::underline(underline_style new_underline)

View File

@ -220,7 +220,7 @@ public:
}
if (!compare_files(left_archive.read(left_member),
right_archive.read(left_member), left_content_type))
left_archive.read(left_member), left_content_type))
{
std::cout << left_member.string() << std::endl;
match = false;