InsetTabular.cpp: fine-tune vertical table alignment to get exactly the result of the latex output

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36494 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-11-25 22:49:05 +00:00
parent f11a0d3eaa
commit dc182537b4

View File

@ -3464,15 +3464,18 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
tabular.setRowDescent(r, maxdes + ADD_TO_HEIGHT + bottom_space);
}
// for top-alignment the first horizontal table line must be exactly at
// the position of the base line of the surrounding text line
// for bottom alignment, the same is for the last table line
switch (tabular.tabular_valignment) {
case Tabular::LYX_VALIGN_BOTTOM:
offset_valign_ = tabular.rowAscent(0) - tabular.height();
break;
case Tabular::LYX_VALIGN_MIDDLE:
offset_valign_ = (tabular.rowAscent(0) - tabular.height()) / 2;
offset_valign_ = (- tabular.height()) / 2 + tabular.rowAscent(0);
break;
case Tabular::LYX_VALIGN_TOP:
offset_valign_ = 0;
offset_valign_ = tabular.rowAscent(0);
break;
}