2015-10-19 03:30:46 +08:00
|
|
|
#include <xlnt/cell/cell.hpp>
|
2014-08-14 06:56:34 +08:00
|
|
|
#include <xlnt/styles/style.hpp>
|
2014-07-27 04:19:15 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
#include "font.hpp"
|
|
|
|
#include "number_format.hpp"
|
|
|
|
#include "protection.hpp"
|
2014-07-27 04:19:15 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
namespace {
|
2014-07-27 04:19:15 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
template <class T>
|
|
|
|
void hash_combine(std::size_t& seed, const T& v)
|
2014-07-27 04:19:15 +08:00
|
|
|
{
|
2015-10-19 03:30:46 +08:00
|
|
|
std::hash<T> hasher;
|
|
|
|
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
2014-07-27 04:19:15 +08:00
|
|
|
}
|
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace xlnt {
|
|
|
|
|
|
|
|
style::style()
|
2014-07-27 04:19:15 +08:00
|
|
|
{
|
|
|
|
}
|
2015-10-14 01:56:07 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
std::size_t style::hash() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
/*
|
2015-10-19 03:30:46 +08:00
|
|
|
std::size_t seed = 100;
|
|
|
|
std::hash<std::string> string_hash;
|
|
|
|
auto font_ = get_font();
|
|
|
|
hash_combine(seed, string_hash(font_.name_));
|
|
|
|
hash_combine(seed, font_.size_);
|
|
|
|
hash_combine(seed, static_cast<std::size_t>(font_.underline_));
|
|
|
|
std::size_t bools = font_.bold_;
|
|
|
|
bools = bools << 1 & font_.italic_;
|
|
|
|
bools = bools << 1 & font_.strikethrough_;
|
|
|
|
bools = bools << 1 & font_.superscript_;
|
|
|
|
bools = bools << 1 & font_.subscript_;
|
|
|
|
hash_combine(seed, bools);
|
2015-10-21 01:53:47 +08:00
|
|
|
*/
|
|
|
|
std::size_t seed = 100;
|
|
|
|
hash_combine(seed, number_format_.hash());
|
2015-10-19 03:30:46 +08:00
|
|
|
|
|
|
|
return seed;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const number_format style::get_number_format() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return number_format_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
2015-10-19 03:30:46 +08:00
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const border style::get_border() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return border_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const alignment style::get_alignment() const
|
2015-10-19 03:30:46 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return alignment_;
|
2015-10-19 03:30:46 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const fill style::get_fill() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return fill_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const font style::get_font() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return font_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-21 01:53:47 +08:00
|
|
|
const protection style::get_protection() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return protection_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
bool style::pivot_button() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return pivot_button_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
bool style::quote_prefix() const
|
2015-10-14 01:56:07 +08:00
|
|
|
{
|
2015-10-21 01:53:47 +08:00
|
|
|
return quote_prefix_;
|
2015-10-14 01:56:07 +08:00
|
|
|
}
|
|
|
|
|
2014-07-27 04:19:15 +08:00
|
|
|
} // namespace xlnt
|