32 static STRING ParagraphJustificationToString(
34 switch (justification) {
47 int rindent,
int rmargin)
const {
48 switch (justification_) {
50 return NearlyEqual(lmargin + lindent, margin_ + first_indent_,
53 return NearlyEqual(rmargin + rindent, margin_ + first_indent_,
56 return NearlyEqual(lindent, rindent, tolerance_ * 2);
64 int rindent,
int rmargin)
const {
65 switch (justification_) {
67 return NearlyEqual(lmargin + lindent, margin_ + body_indent_,
70 return NearlyEqual(rmargin + rindent, margin_ + body_indent_,
73 return NearlyEqual(lindent, rindent, tolerance_ * 2);
81 if (justification_ != other.justification_)
86 int tolerance = (tolerance_ + other.tolerance_) / 4;
88 other.margin_ + other.first_indent_,
tolerance) &&
90 other.margin_ + other.body_indent_,
tolerance);
95 const STRING &alignment = ParagraphJustificationToString(justification_);
96 snprintf(buffer,
sizeof(buffer),
97 "margin: %d, first_indent: %d, body_indent: %d, alignment: %s",
98 margin_, first_indent_, body_indent_, alignment.
string());
const char * string() const
bool Comparable(const ParagraphModel &other) const
bool NearlyEqual(T x, T y, T tolerance)
bool ValidFirstLine(int lmargin, int lindent, int rindent, int rmargin) const
#define ELISTIZE(CLASSNAME)
bool ValidBodyLine(int lmargin, int lindent, int rindent, int rmargin) const