row.dimension().wid += w;
}
break;
+ case LYX_ALIGN_LEFT:
+ // a displayed inset that is flushed
+ if (Inset const * inset = par.getInset(row.pos()))
+ row.left_margin += inset->indent(*bv_);
+ break;
case LYX_ALIGN_RIGHT:
- row.left_margin += w;
- row.dimension().wid += w;
+ if (Inset const * inset = par.getInset(row.pos())) {
+ int const new_w = max(w - inset->indent(*bv_), 0);
+ row.left_margin += new_w;
+ row.dimension().wid += new_w;
+ } else {
+ row.left_margin += w;
+ row.dimension().wid += w;
+ }
break;
case LYX_ALIGN_CENTER:
row.dimension().wid += w / 2;
row.left_margin += w / 2;
break;
- case LYX_ALIGN_LEFT:
case LYX_ALIGN_NONE:
case LYX_ALIGN_LAYOUT:
case LYX_ALIGN_SPECIAL:
/// should we have a non-filled line before this inset?
virtual DisplayType display() const { return Inline; }
+ /// indentation before this inset (only needed for displayed hull insets with fleqn option)
+ virtual int indent(BufferView const &) const { return 0; }
///
virtual LyXAlignment contentAlignment() const { return LYX_ALIGN_NONE; }
/// should we break lines after this inset?
case hullEquation:
case hullMultline:
case hullGather:
- return AlignCenter;
+ if (buffer().params().is_math_indent)
+ return AlignLeft;
+ else
+ return AlignCenter;
}
// avoid warning
return AlignCenter;
}
+
+int InsetMathHull::indent(BufferView const & bv) const
+{
+ // FIXME: set this in the textclass. This value is what the article class uses.
+ static Length default_indent(2.5, Length::EM);
+ if (buffer().params().is_math_indent) {
+ Length const & len = buffer().params().getMathIndent();
+ if (len.empty())
+ return bv.inPixels(default_indent);
+ else
+ return bv.inPixels(len);
+ } else
+ return Inset::indent(bv);
+}
+
+
bool InsetMathHull::numberedType() const
{
switch (type_) {
Inset * editXY(Cursor & cur, int x, int y);
///
DisplayType display() const;
+ ///
+ int indent(BufferView const &) const;
protected:
///