Am Montag, 12. Juni 2006 15:13 schrieb Juergen Spitzmueller:

> I had a quick look. It looks good. However, it should be possible to use 
> \addlinespace (without optional argument). I guess most of the time 
you'll 
> need the same linespace, which is then globally defined.

This patch adds that. It goes in now, please test.

Known problems: qt4 crashes if you want to change the spaces, I don't know 
why.

I have no further plans for the booktabs branch. Is anything missing? 
Edwin, could you please have a look at the qt4 problem? After that is 
fixed the branch could be merged.


Georg

Log:

add support for additional line space
        * src/insets/insettabular.C
        (tabularFeature): add SET_TOP_SPACE, SET_BOTTOM_SPACE and
        SET_INTERLINE_SPACE
        (InsetTabular::metrics): handle top and bottom space
        (InsetTabular::getStatus): handle SET_TOP_SPACE, SET_BOTTOM_SPACE and
        SET_INTERLINE_SPACE
        (InsetTabular::tabularFeatures): ditto
        (InsetTabular::dist): handle top, bottom and interline space

        * src/frontends/qt[34]/QTabularDialog.[Ch]
        (topspace_changed): new slot
        (bottomspace_changed): new slot
        (interlinespace_changed): new slot

        * src/frontends/qt[34]/QTabularDialog.C
        (QTabularDialog::QTabularDialog): handle new space widgets

        * src/frontends/qt3/ui/QTabularDialogBase.ui: add new "Row Settings"
        tab, containing widgets for the new vertical spaces


        * src/frontends/qt[34]/QTabular.C
        (QTabular::build_dialog): handle new space widgets
        (QTabular::update_contents): ditto
        (QTabular::closeGUI): ditto

        * src/frontends/qt4/ui/QTabularUi.ui: add new "Row Settings" tab,
        containing widgets for the new vertical spaces

        * src/frontends/xforms/FormTabular.C
        (FormTabular::build): handle new space widgets
        (FormTabular::update): ditto
        (FormTabular::input): ditto

        * src/frontends/xforms/forms/form_tabular.fd: add widgets for the
        new vertical spaces

        * src/tabular.C
        (getTokenValue):new, read a LyXLength with default flag
        (LyXTabular::getAdditionalHeight): handle interline_space
        (LyXTabular::write): handle topspace, bottomspace and interlinespace
        (LyXTabular::read): ditto
        (LyXTabular::TeXBottomHLine): whitespace
        (LyXTabular::TeXRow): handle top_space, bottom_space and
        interline_space

        * src/tabular.h
        (LyXTabular::Feature): add SET_TOP_SPACE, SET_BOTTOM_SPACE and
        SET_INTERLINE_SPACE
        (LyXTabular::rowstruct): add top_space, bottom_space and
        interline_space

        * lib/lyx2lyx/lyx_1_5.py
        (revert_font_settings): fix indentation
        (def revert_booktabs): revert topspace, bottomspace and interlinespace
Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C	(Revision 14175)
+++ src/insets/insettabular.C	(Arbeitskopie)
@@ -72,6 +72,7 @@ namespace {
 
 int const ADD_TO_HEIGHT = 2;
 int const ADD_TO_TABULAR_WIDTH = 2;
+int const default_line_space = 10;
 
 ///
 boost::scoped_ptr<LyXTabular> paste_tabular;
@@ -135,6 +136,9 @@ TabularFeature tabularFeature[] =
 	{ LyXTabular::SET_SPECIAL_MULTI, "set-special-multi" },
 	{ LyXTabular::SET_BOOKTABS, "set-booktabs" },
 	{ LyXTabular::UNSET_BOOKTABS, "unset-booktabs" },
+	{ LyXTabular::SET_TOP_SPACE, "set-top-space" },
+	{ LyXTabular::SET_BOTTOM_SPACE, "set-bottom-space" },
+	{ LyXTabular::SET_INTERLINE_SPACE, "set-interline-space" },
 	{ LyXTabular::LAST_ACTION, "" }
 };
 
@@ -270,8 +274,14 @@ void InsetTabular::metrics(MetricsInfo &
 			tabular.setWidthOfCell(cell, dim.wid);
 			++cell;
 		}
-		tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT);
-		tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT);
+		int const top_space = tabular.row_info[i].top_space_default ?
+			default_line_space :
+			tabular.row_info[i].top_space.inPixels(mi.base.textwidth);
+		tabular.setAscentOfRow(i, maxAsc + ADD_TO_HEIGHT + top_space);
+		int const bottom_space = tabular.row_info[i].bottom_space_default ?
+			default_line_space :
+			tabular.row_info[i].bottom_space.inPixels(mi.base.textwidth);
+		tabular.setDescentOfRow(i, maxDesc + ADD_TO_HEIGHT + bottom_space);
 	}
 
 	dim.asc = tabular.getAscentOfRow(0);
@@ -814,6 +824,9 @@ bool InsetTabular::getStatus(LCursor & c
 		case LyXTabular::DELETE_COLUMN:
 		case LyXTabular::SET_ALL_LINES:
 		case LyXTabular::UNSET_ALL_LINES:
+		case LyXTabular::SET_TOP_SPACE:
+		case LyXTabular::SET_BOTTOM_SPACE:
+		case LyXTabular::SET_INTERLINE_SPACE:
 			status.clear();
 			return true;
 
@@ -1141,11 +1154,10 @@ int InsetTabular::dist(idx_type const ce
 	Point o = theCoords.getInsets().xy(&inset);
 	int const xbeg = o.x_ - tabular.getBeginningOfTextInCell(cell);
 	int const xend = xbeg + tabular.getWidthOfColumn(cell);
-	int const ybeg = o.y_ - inset.ascent();
 	row_type const row = tabular.row_of_cell(cell);
-	int const rowheight = tabular.getAscentOfRow(row)
-			+ tabular.getDescentOfRow(row);
-	int const yend = ybeg + rowheight;
+	int const ybeg = o.y_ - tabular.getAscentOfRow(row) -
+	                 tabular.getAdditionalHeight(row);
+	int const yend = o.y_ + tabular.getDescentOfRow(row);
 
 	if (x < xbeg)
 		xx = xbeg - x;
@@ -1656,6 +1668,54 @@ void InsetTabular::tabularFeatures(LCurs
 		tabular.setBookTabs(false);
 		break;
 
+	case LyXTabular::SET_TOP_SPACE: {
+		LyXLength len;
+		if (value == "default")
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].top_space_default = true;
+		else if (isValidLength(value, &len))
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
+				tabular.row_info[i].top_space_default = false;
+				tabular.row_info[i].top_space = len;
+			}
+		else
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].top_space_default = false;
+		break;
+	}
+
+	case LyXTabular::SET_BOTTOM_SPACE: {
+		LyXLength len;
+		if (value == "default")
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].bottom_space_default = true;
+		else if (isValidLength(value, &len))
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
+				tabular.row_info[i].bottom_space_default = false;
+				tabular.row_info[i].bottom_space = len;
+			}
+		else
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].bottom_space_default = false;
+		break;
+	}
+
+	case LyXTabular::SET_INTERLINE_SPACE: {
+		LyXLength len;
+		if (value == "default")
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].interline_space_default = true;
+		else if (isValidLength(value, &len))
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i) {
+				tabular.row_info[i].interline_space_default = false;
+				tabular.row_info[i].interline_space = len;
+			}
+		else
+			for (row_type i = sel_row_start; i <= sel_row_end; ++i)
+				tabular.row_info[i].interline_space_default = false;
+		break;
+	}
+
 	// dummy stuff just to avoid warnings
 	case LyXTabular::LAST_ACTION:
 		break;
Index: src/frontends/qt3/QTabularDialog.C
===================================================================
--- src/frontends/qt3/QTabularDialog.C	(Revision 14175)
+++ src/frontends/qt3/QTabularDialog.C	(Arbeitskopie)
@@ -14,9 +14,11 @@
 
 #include "QTabularDialog.h"
 #include "QTabular.h"
+#include "lengthcombo.h"
 #include "validators.h"
 #include "qt_helpers.h"
 
+#include "controllers/ButtonController.h"
 #include "controllers/ControlTabular.h"
 
 #include <qcheckbox.h>
@@ -37,6 +39,9 @@ QTabularDialog::QTabularDialog(QTabular 
 		form, SLOT(slotClose()));
 
 	widthED->setValidator(unsignedLengthValidator(widthED));
+	topspaceED->setValidator(new LengthValidator(topspaceED));
+	bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
+	interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
 }
 
 
@@ -119,6 +124,60 @@ void QTabularDialog::width_changed()
 }
 
 
+void QTabularDialog::topspace_changed()
+{
+	if (topspaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_TOP_SPACE, "default");
+		topspaceED->setEnabled(false);
+		topspaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_TOP_SPACE,
+			widgetsToLength(topspaceED, topspaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			topspaceED->setEnabled(true);
+			topspaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
+void QTabularDialog::bottomspace_changed()
+{
+	if (bottomspaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
+		bottomspaceED->setEnabled(false);
+		bottomspaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_BOTTOM_SPACE,
+			widgetsToLength(bottomspaceED, bottomspaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			bottomspaceED->setEnabled(true);
+			bottomspaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
+void QTabularDialog::interlinespace_changed()
+{
+	if (interlinespaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
+		interlinespaceED->setEnabled(false);
+		interlinespaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_INTERLINE_SPACE,
+			widgetsToLength(interlinespaceED, interlinespaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			interlinespaceED->setEnabled(true);
+			interlinespaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
 void QTabularDialog::multicolumn_clicked()
 {
 	form_->controller().toggleMultiColumn();
Index: src/frontends/qt3/ui/QTabularDialogBase.ui
===================================================================
--- src/frontends/qt3/ui/QTabularDialogBase.ui	(Revision 14175)
+++ src/frontends/qt3/ui/QTabularDialogBase.ui	(Arbeitskopie)
@@ -306,6 +306,220 @@
                     </widget>
                 </grid>
             </widget>
+
+            <widget class="QWidget">
+                <property name="name">
+                    <cstring>tab</cstring>
+                </property>
+                <attribute name="title">
+                    <string>&amp;Row Settings</string>
+                </attribute>
+                <grid>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <property name="margin">
+                        <number>11</number>
+                    </property>
+                    <property name="spacing">
+                        <number>6</number>
+                    </property>
+                    <widget class="LengthCombo" row="0"  column="2" >
+                        <property name="name">
+                            <cstring>topspaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Topspace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="0"  column="1" >
+                        <property name="name">
+                            <cstring>topspaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space above the row</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="0"  column="0" >
+                        <property name="name">
+                            <cstring>topspaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Top space:</string>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>topspaceED</cstring>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox" row="0" column="3">
+                        <property name="name">
+                            <cstring>topspaceCB</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Default</string>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>Use the default top space amount</string>
+                        </property>
+                    </widget>
+                    <widget class="LengthCombo" row="1"  column="2" >
+                        <property name="name">
+                            <cstring>bottomspaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Bottomspace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="1"  column="1" >
+                        <property name="name">
+                            <cstring>bottomspaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space below the row</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="1"  column="0" >
+                        <property name="name">
+                            <cstring>bottomspaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Bottom space:</string>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>bottomspaceED</cstring>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox" row="1" column="3">
+                        <property name="name">
+                            <cstring>bottomspaceCB</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Default</string>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>Use the default bottom space amount</string>
+                        </property>
+                    </widget>
+                    <widget class="LengthCombo" row="2"  column="2" >
+                        <property name="name">
+                            <cstring>interlinespaceUnit</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="minimumSize">
+                            <size>
+                                <width>50</width>
+                                <height>0</height>
+                            </size>
+                        </property>
+                        <property name="focusPolicy">
+                            <enum>StrongFocus</enum>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Interlinespace unit</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit" row="2"  column="1" >
+                        <property name="name">
+                            <cstring>interlinespaceED</cstring>
+                        </property>
+                        <property name="enabled">
+                            <bool>true</bool>
+                        </property>
+                        <property name="text">
+                            <string></string>
+                        </property>
+                        <property>
+                            <name>toolTip</name>
+                            <string>Extra space below the bottom line</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel" row="2"  column="0" >
+                        <property name="name">
+                            <cstring>interlinespaceLA</cstring>
+                        </property>
+                        <property name="text">
+                            <string>&amp;Interline space:</string>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>interlinespaceED</cstring>
+                        </property>
+                    </widget>
+                    <widget class="QCheckBox" row="2" column="3">
+                        <property name="name">
+                            <cstring>interlinespaceCB</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Default</string>
+                        </property>
+                        <property name="toolTip" stdset="0">
+                            <string>Use the default interline space amount</string>
+                        </property>
+                    </widget>
+                    <spacer row="3"  column="0" >
+                        <property name="name">
+                            <cstring>Spacer8</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property>
+                            <name>sizeHint</name>
+                            <size>
+                                <width>20</width>
+                                <height>20</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </grid>
+            </widget>
+
+
             <widget class="QWidget">
                 <property name="name">
                     <cstring>tab</cstring>
@@ -1297,6 +1511,60 @@
         <slot>width_changed()</slot>
     </connection>
     <connection>
+        <sender>topspaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>topspaceCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>topspaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>topspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>bottomspaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>bottomspaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>bottomspaceCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>bottomspace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>interlinespaceED</sender>
+        <signal>returnPressed()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>interlinespace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>interlinespaceUnit</sender>
+        <signal>selectionChanged(LyXLength::UNIT)</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>interlinespace_changed()</slot>
+    </connection>
+    <connection>
+        <sender>interlinespaceCB</sender>
+        <signal>clicked()</signal>
+        <receiver>QTabularDialogBase</receiver>
+        <slot>interlinespace_changed()</slot>
+    </connection>
+    <connection>
         <sender>closePB</sender>
         <signal>clicked()</signal>
         <receiver>QTabularDialogBase</receiver>
@@ -1363,6 +1631,15 @@
     <tabstop>specialAlignmentED</tabstop>
     <tabstop>borderSetPB</tabstop>
     <tabstop>borderUnsetPB</tabstop>
+    <tabstop>topspaceED</tabstop>
+    <tabstop>topspaceUnit</tabstop>
+    <tabstop>topspaceCB</tabstop>
+    <tabstop>bottomspaceED</tabstop>
+    <tabstop>bottomspaceUnit</tabstop>
+    <tabstop>bottomspaceCB</tabstop>
+    <tabstop>interlinespaceED</tabstop>
+    <tabstop>interlinespaceUnit</tabstop>
+    <tabstop>interlinespaceCB</tabstop>
     <tabstop>longTabularCB</tabstop>
     <tabstop>headerStatusCB</tabstop>
     <tabstop>headerBorderAboveCB</tabstop>
@@ -1418,6 +1695,9 @@
     <slot access="protected">topBorder_changed()</slot>
     <slot access="protected">vAlign_changed(int)</slot>
     <slot access="protected">width_changed()</slot>
+    <slot access="protected">topspace_changed()</slot>
+    <slot access="protected">bottomspace_changed()</slot>
+    <slot access="protected">interlinespace_changed()</slot>
 </slots>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>
Index: src/frontends/qt3/QTabularDialog.h
===================================================================
--- src/frontends/qt3/QTabularDialog.h	(Revision 14175)
+++ src/frontends/qt3/QTabularDialog.h	(Arbeitskopie)
@@ -43,6 +43,9 @@ protected slots:
 	virtual void vAlign_changed(int align);
 	virtual void specialAlignment_changed();
 	virtual void width_changed();
+	virtual void topspace_changed();
+	virtual void bottomspace_changed();
+	virtual void interlinespace_changed();
 	virtual void longTabular();
 	virtual void ltNewpage_clicked();
 	virtual void ltHeaderStatus_clicked();
Index: src/frontends/qt3/QTabular.C
===================================================================
--- src/frontends/qt3/QTabular.C	(Revision 14175)
+++ src/frontends/qt3/QTabular.C	(Arbeitskopie)
@@ -77,10 +77,25 @@ void QTabular::build_dialog()
 	bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
 	bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
 	bcview().addReadOnly(dialog_->newpageCB);
+	bcview().addReadOnly(dialog_->topspaceED);
+	bcview().addReadOnly(dialog_->topspaceUnit);
+	bcview().addReadOnly(dialog_->topspaceCB);
+	bcview().addReadOnly(dialog_->bottomspaceED);
+	bcview().addReadOnly(dialog_->bottomspaceUnit);
+	bcview().addReadOnly(dialog_->bottomspaceCB);
+	bcview().addReadOnly(dialog_->interlinespaceED);
+	bcview().addReadOnly(dialog_->interlinespaceUnit);
+	bcview().addReadOnly(dialog_->interlinespaceCB);
 
 	// initialize the length validator
 	addCheckedLineEdit(bcview(), dialog_->widthED,
 		dialog_->fixedWidthColLA);
+	addCheckedLineEdit(bcview(), dialog_->topspaceED,
+		dialog_->topspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
+		dialog_->bottomspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
+		dialog_->interlinespaceLA);
 }
 
 
@@ -236,6 +251,45 @@ void QTabular::update_contents()
 	dialog_->hAlignCB->setEnabled(true);
 	dialog_->vAlignCB->setEnabled(!pwidth.zero());
 
+	lengthToWidgets(dialog_->topspaceED, dialog_->topspaceUnit,
+		tabular.row_info[row].top_space.asString(), default_unit);
+	if (tabular.row_info[row].top_space_default) {
+		dialog_->topspaceCB->setChecked(true);
+		dialog_->topspaceED->setEnabled(false);
+		dialog_->topspaceUnit->setEnabled(false);
+	} else {
+		dialog_->topspaceCB->setChecked(false);
+		dialog_->topspaceED->setEnabled(!isReadonly);
+		dialog_->topspaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->topspaceCB->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->bottomspaceED, dialog_->bottomspaceUnit,
+		tabular.row_info[row].bottom_space.asString(), default_unit);
+	if (tabular.row_info[row].bottom_space_default) {
+		dialog_->bottomspaceCB->setChecked(true);
+		dialog_->bottomspaceED->setEnabled(false);
+		dialog_->bottomspaceUnit->setEnabled(false);
+	} else {
+		dialog_->bottomspaceCB->setChecked(false);
+		dialog_->bottomspaceED->setEnabled(!isReadonly);
+		dialog_->bottomspaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->bottomspaceCB->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->interlinespaceED, dialog_->interlinespaceUnit,
+		tabular.row_info[row].interline_space.asString(), default_unit);
+	if (tabular.row_info[row].interline_space_default) {
+		dialog_->interlinespaceCB->setChecked(true);
+		dialog_->interlinespaceED->setEnabled(false);
+		dialog_->interlinespaceUnit->setEnabled(false);
+	} else {
+		dialog_->interlinespaceCB->setChecked(false);
+		dialog_->interlinespaceED->setEnabled(!isReadonly);
+		dialog_->interlinespaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->interlinespaceCB->setEnabled(!isReadonly);
+
 	if (!tabular.isLongTabular()) {
 		dialog_->headerStatusCB->setChecked(false);
 		dialog_->headerBorderAboveCB->setChecked(false);
@@ -373,6 +427,22 @@ void QTabular::closeGUI()
 		else
 			controller().set(LyXTabular::SET_PWIDTH, width);
 	}
+
+	if (dialog_->topspaceCB->isChecked())
+		controller().set(LyXTabular::SET_TOP_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_TOP_SPACE,
+			widgetsToLength(dialog_->topspaceED, dialog_->topspaceUnit));
+	if (dialog_->bottomspaceCB->isChecked())
+		controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_BOTTOM_SPACE,
+			widgetsToLength(dialog_->bottomspaceED, dialog_->bottomspaceUnit));
+	if (dialog_->interlinespaceCB->isChecked())
+		controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_INTERLINE_SPACE,
+			widgetsToLength(dialog_->interlinespaceED, dialog_->interlinespaceUnit));
 }
 
 } // namespace frontend
Index: src/frontends/qt4/QTabularDialog.C
===================================================================
--- src/frontends/qt4/QTabularDialog.C	(Revision 14176)
+++ src/frontends/qt4/QTabularDialog.C	(Arbeitskopie)
@@ -17,6 +17,7 @@
 #include "validators.h"
 #include "qt_helpers.h"
 
+#include "controllers/ButtonController.h"
 #include "controllers/ControlTabular.h"
 
 #include <QCloseEvent>
@@ -36,9 +37,26 @@ QTabularDialog::QTabularDialog(QTabular 
 	setupUi(this);
 
 	widthED->setValidator(unsignedLengthValidator(widthED));
-
+	topspaceED->setValidator(new LengthValidator(topspaceED));
+	bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
+	interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
+
+	connect(topspaceED, SIGNAL(textChanged(const QString &)),
+	        this, SLOT(topspace_changed()));
+	connect(topspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)),
+	        this, SLOT(topspace_changed()));
+	connect(topspaceCB, SIGNAL(clicked()), this, SLOT(topspace_changed()));
+	connect(bottomspaceED, SIGNAL(textChanged(const QString &)),
+	        this, SLOT(bottomspace_changed()));
+	connect(bottomspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)),
+	        this, SLOT(bottomspace_changed()));
+	connect(bottomspaceCB, SIGNAL(clicked()), this, SLOT(bottomspace_changed()));
+	connect(interlinespaceED, SIGNAL(textChanged(const QString &)),
+	        this, SLOT(interlinespace_changed()));
+	connect(interlinespaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)),
+	        this, SLOT(interlinespace_changed()));
+	connect(interlinespaceCB, SIGNAL(clicked()), this, SLOT(interlinespace_changed()));
 	connect(booktabsCB, SIGNAL(clicked()), this, SLOT(on_booktabsCB_stateChanged()));
-
 	connect( borderSetPB, SIGNAL( clicked() ), this, SLOT( borderSet_clicked() ) );
     connect( borderUnsetPB, SIGNAL( clicked() ), this, SLOT( borderUnset_clicked() ) );
     connect( longTabularCB, SIGNAL( toggled(bool) ), longtableGB, SLOT( setEnabled(bool) ) );
@@ -95,6 +113,60 @@ void QTabularDialog::on_booktabsCB_state
 }
 
 
+void QTabularDialog::topspace_changed()
+{
+	if (topspaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_TOP_SPACE, "default");
+		topspaceED->setEnabled(false);
+		topspaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_TOP_SPACE,
+				widgetsToLength(topspaceED, topspaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			topspaceED->setEnabled(true);
+			topspaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
+void QTabularDialog::bottomspace_changed()
+{
+	if (bottomspaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
+		bottomspaceED->setEnabled(false);
+		bottomspaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_BOTTOM_SPACE,
+			widgetsToLength(bottomspaceED, bottomspaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			bottomspaceED->setEnabled(true);
+			bottomspaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
+void QTabularDialog::interlinespace_changed()
+{
+	if (interlinespaceCB->isChecked()) {
+		form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
+		interlinespaceED->setEnabled(false);
+		interlinespaceUnit->setEnabled(false);
+	} else {
+		form_->controller().set(LyXTabular::SET_INTERLINE_SPACE,
+			widgetsToLength(interlinespaceED, interlinespaceUnit));
+		if (!form_->bc().bp().isReadOnly()) {
+			interlinespaceED->setEnabled(true);
+			interlinespaceUnit->setEnabled(true);
+		}
+	}
+	form_->changed();
+}
+
+
 void QTabularDialog::close_clicked()
 {
 	form_->closeGUI();
Index: src/frontends/qt4/ui/QTabularUi.ui
===================================================================
--- src/frontends/qt4/ui/QTabularUi.ui	(Revision 14176)
+++ src/frontends/qt4/ui/QTabularUi.ui	(Arbeitskopie)
@@ -249,6 +249,84 @@
          </property>
         </spacer>
        </item>
+       <item row="2" column="2" >
+        <widget class="LengthCombo" name="interlinespaceUnit" />
+       </item>
+       <item row="1" column="2" >
+        <widget class="LengthCombo" name="bottomspaceUnit" />
+       </item>
+       <item row="0" column="2" >
+        <widget class="LengthCombo" name="topspaceUnit" />
+       </item>
+       <item row="2" column="0" >
+        <widget class="QLabel" name="interlinespaceLA" >
+         <property name="text" >
+          <string>&amp;Interline space</string>
+         </property>
+         <property name="buddy" >
+          <cstring>interlinespaceED</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0" >
+        <widget class="QLabel" name="bottomspaceLA" >
+         <property name="text" >
+          <string>&amp;Bottom space</string>
+         </property>
+         <property name="buddy" >
+          <cstring>bottomspaceED</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0" >
+        <widget class="QLabel" name="topspaceLA" >
+         <property name="text" >
+          <string>&amp;Top space</string>
+         </property>
+         <property name="buddy" >
+          <cstring>topspaceED</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1" >
+        <widget class="QLineEdit" name="interlinespaceED" />
+       </item>
+       <item row="1" column="1" >
+        <widget class="QLineEdit" name="bottomspaceED" />
+       </item>
+       <item row="0" column="1" >
+        <widget class="QLineEdit" name="topspaceED" />
+       </item>
+       <item row="0" column="3" >
+        <widget class="QCheckBox" name="topspaceCB" >
+         <property name="toolTip" >
+          <string>Use the default top space amount</string>
+         </property>
+         <property name="text" >
+          <string>Default</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="3" >
+        <widget class="QCheckBox" name="bottomspaceCB" >
+         <property name="toolTip" >
+          <string>Use the default bottom space amount</string>
+         </property>
+         <property name="text" >
+          <string>Default</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="3" >
+        <widget class="QCheckBox" name="interlinespaceCB" >
+         <property name="toolTip" >
+          <string>Use the default interline space amount</string>
+         </property>
+         <property name="text" >
+          <string>Default</string>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="Borders" >
@@ -1038,6 +1116,15 @@
   <tabstop>rotateCellCB</tabstop>
   <tabstop>specialAlignmentED</tabstop>
   <tabstop>TabWidget</tabstop>
+  <tabstop>topspaceED</tabstop>
+  <tabstop>topspaceUnit</tabstop>
+  <tabstop>topspaceeCB</tabstop>
+  <tabstop>bottomspaceED</tabstop>
+  <tabstop>bottomspaceUnit</tabstop>
+  <tabstop>bottomspaceeCB</tabstop>
+  <tabstop>interlinespaceED</tabstop>
+  <tabstop>interlinespaceUnit</tabstop>
+  <tabstop>interlinespaceeCB</tabstop>
   <tabstop>hAlignCB</tabstop>
   <tabstop>borderSetPB</tabstop>
   <tabstop>borderUnsetPB</tabstop>
Index: src/frontends/qt4/QTabularDialog.h
===================================================================
--- src/frontends/qt4/QTabularDialog.h	(Revision 14176)
+++ src/frontends/qt4/QTabularDialog.h	(Arbeitskopie)
@@ -32,6 +32,9 @@ public:
 protected slots:
 	virtual void change_adaptor();
 
+	virtual void topspace_changed();
+	virtual void bottomspace_changed();
+	virtual void interlinespace_changed();
 	virtual void on_booktabsCB_stateChanged(int);
 	virtual void close_clicked();
 	virtual void borderSet_clicked();
Index: src/frontends/qt4/QTabular.C
===================================================================
--- src/frontends/qt4/QTabular.C	(Revision 14176)
+++ src/frontends/qt4/QTabular.C	(Arbeitskopie)
@@ -49,6 +49,15 @@ void QTabular::build_dialog()
 
 	bcview().setCancel(dialog_->closePB);
 
+	bcview().addReadOnly(dialog_->topspaceED);
+	bcview().addReadOnly(dialog_->topspaceUnit);
+	bcview().addReadOnly(dialog_->topspaceCB);
+	bcview().addReadOnly(dialog_->bottomspaceED);
+	bcview().addReadOnly(dialog_->bottomspaceUnit);
+	bcview().addReadOnly(dialog_->bottomspaceCB);
+	bcview().addReadOnly(dialog_->interlinespaceED);
+	bcview().addReadOnly(dialog_->interlinespaceUnit);
+	bcview().addReadOnly(dialog_->interlinespaceCB);
 	bcview().addReadOnly(dialog_->booktabsCB);
 
 	bcview().addReadOnly(dialog_->multicolumnCB);
@@ -82,6 +91,12 @@ void QTabular::build_dialog()
 	// initialize the length validator
 	addCheckedLineEdit(bcview(), dialog_->widthED,
 		dialog_->fixedWidthColLA);
+	addCheckedLineEdit(bcview(), dialog_->topspaceED,
+		dialog_->topspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
+		dialog_->bottomspaceLA);
+	addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
+		dialog_->interlinespaceLA);
 }
 
 
@@ -173,6 +188,45 @@ void QTabular::update_contents()
 
 	LyXLength::UNIT default_unit = controller().useMetricUnits() ? LyXLength::CM : LyXLength::IN;
 
+	lengthToWidgets(dialog_->topspaceED, dialog_->topspaceUnit,
+		tabular.row_info[row].top_space.asString(), default_unit);
+	if (tabular.row_info[row].top_space_default) {
+		dialog_->topspaceCB->setChecked(true);
+		dialog_->topspaceED->setEnabled(false);
+		dialog_->topspaceUnit->setEnabled(false);
+	} else {
+		dialog_->topspaceCB->setChecked(false);
+		dialog_->topspaceED->setEnabled(!isReadonly);
+		dialog_->topspaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->topspaceCB->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->bottomspaceED, dialog_->bottomspaceUnit,
+		tabular.row_info[row].bottom_space.asString(), default_unit);
+	if (tabular.row_info[row].bottom_space_default) {
+		dialog_->bottomspaceCB->setChecked(true);
+		dialog_->bottomspaceED->setEnabled(false);
+		dialog_->bottomspaceUnit->setEnabled(false);
+	} else {
+		dialog_->bottomspaceCB->setChecked(false);
+		dialog_->bottomspaceED->setEnabled(!isReadonly);
+		dialog_->bottomspaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->bottomspaceCB->setEnabled(!isReadonly);
+
+	lengthToWidgets(dialog_->bottomspaceED, dialog_->interlinespaceUnit,
+		tabular.row_info[row].interline_space.asString(), default_unit);
+	if (tabular.row_info[row].interline_space_default) {
+		dialog_->interlinespaceCB->setChecked(true);
+		dialog_->interlinespaceED->setEnabled(false);
+		dialog_->interlinespaceUnit->setEnabled(false);
+	} else {
+		dialog_->interlinespaceCB->setChecked(false);
+		dialog_->interlinespaceED->setEnabled(!isReadonly);
+		dialog_->interlinespaceUnit->setEnabled(!isReadonly);
+	}
+	dialog_->interlinespaceCB->setEnabled(!isReadonly);
+
 	string colwidth;
 	if (!pwidth.zero())
 		colwidth = pwidth.asString();
@@ -373,6 +427,24 @@ void QTabular::closeGUI()
 		else
 			controller().set(LyXTabular::SET_PWIDTH, width);
 	}
+
+	/* DO WE NEED THIS?
+	if (dialog_->topspaceCB->isChecked())
+		controller().set(LyXTabular::SET_TOP_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_TOP_SPACE,
+			widgetsToLength(dialog_->topspaceED, dialog_->topspaceUnit));
+	if (dialog_->bottomspaceCB->isChecked())
+		controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_BOTTOM_SPACE,
+			widgetsToLength(dialog_->bottomspaceED, dialog_->bottomspaceUnit));
+	if (dialog_->interlinespaceCB->isChecked())
+		controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
+	else
+		controller().set(LyXTabular::SET_INTERLINE_SPACE,
+			widgetsToLength(dialog_->interlinespaceED, dialog_->interlinespaceUnit));
+*/
 }
 
 } // namespace frontend
Index: src/frontends/xforms/FormTabular.C
===================================================================
--- src/frontends/xforms/FormTabular.C	(Revision 14175)
+++ src/frontends/xforms/FormTabular.C	(Arbeitskopie)
@@ -100,15 +100,30 @@ void FormTabular::build()
 
 	fl_set_input_return(column_options_->input_column_width,
 			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_topspace,
+			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_bottomspace,
+			    FL_RETURN_END);
+	fl_set_input_return(column_options_->input_interlinespace,
+			    FL_RETURN_END);
 	fl_set_input_return(column_options_->input_special_alignment,
 			    FL_RETURN_END);
 
 	// trigger an input event for cut&paste with middle mouse button.
 	setPrehandler(column_options_->input_column_width);
+	setPrehandler(column_options_->input_topspace);
+	setPrehandler(column_options_->input_bottomspace);
+	setPrehandler(column_options_->input_interlinespace);
 	setPrehandler(column_options_->input_special_alignment);
 
 	fl_addto_choice(column_options_->choice_value_column_width,
 			units.c_str());
+	fl_addto_choice(column_options_->choice_value_topspace,
+			units.c_str());
+	fl_addto_choice(column_options_->choice_value_bottomspace,
+			units.c_str());
+	fl_addto_choice(column_options_->choice_value_interlinespace,
+			units.c_str());
 
 	// cell options form
 	cell_options_.reset(build_tabular_cell(this));
@@ -164,6 +179,12 @@ void FormTabular::update()
 	fl_activate_object(cell_options_->input_special_multialign);
 	fl_activate_object(column_options_->input_column_width);
 	fl_activate_object(column_options_->choice_value_column_width);
+	fl_activate_object(column_options_->input_topspace);
+	fl_activate_object(column_options_->choice_value_topspace);
+	fl_activate_object(column_options_->input_bottomspace);
+	fl_activate_object(column_options_->choice_value_bottomspace);
+	fl_activate_object(column_options_->input_interlinespace);
+	fl_activate_object(column_options_->choice_value_interlinespace);
 	fl_set_input(dialog_->input_tabular_column,
 		     convert<string>(column).c_str());
 	fl_deactivate_object(dialog_->input_tabular_column);
@@ -323,6 +344,39 @@ void FormTabular::update()
 	setEnabled(column_options_->input_column_width, !isReadonly);
 	setEnabled(column_options_->choice_value_column_width, !isReadonly);
 
+	if (tabular.row_info[row].top_space_default)
+		fl_set_input(column_options_->input_topspace, "default");
+	else {
+		updateWidgetsFromLength(column_options_->input_topspace,
+				column_options_->choice_value_topspace,
+				tabular.row_info[row].top_space,
+				default_unit);
+	}
+	setEnabled(column_options_->input_topspace, !isReadonly);
+	setEnabled(column_options_->choice_value_topspace, !isReadonly);
+
+	if (tabular.row_info[row].bottom_space_default)
+		fl_set_input(column_options_->input_bottomspace, "default");
+	else {
+		updateWidgetsFromLength(column_options_->input_bottomspace,
+				column_options_->choice_value_bottomspace,
+				tabular.row_info[row].bottom_space,
+				default_unit);
+	}
+	setEnabled(column_options_->input_bottomspace, !isReadonly);
+	setEnabled(column_options_->choice_value_bottomspace, !isReadonly);
+
+	if (tabular.row_info[row].interline_space_default)
+		fl_set_input(column_options_->input_interlinespace, "default");
+	else {
+		updateWidgetsFromLength(column_options_->input_interlinespace,
+				column_options_->choice_value_interlinespace,
+				tabular.row_info[row].interline_space,
+				default_unit);
+	}
+	setEnabled(column_options_->input_interlinespace, !isReadonly);
+	setEnabled(column_options_->choice_value_interlinespace, !isReadonly);
+
 	setEnabled(cell_options_->check_useminipage, !pwidth.zero());
 	if (!pwidth.zero()) {
 		if (tabular.getUsebox(cell) == 2)
@@ -570,6 +624,72 @@ ButtonPolicy::SMInput FormTabular::input
 		return ButtonPolicy::SMI_VALID;
 	}
 
+	if ((ob == column_options_->input_topspace) ||
+	    (ob == column_options_->choice_value_topspace)) {
+		string const input = getString(column_options_->input_topspace);
+		if (input == "default")
+			controller().set(LyXTabular::SET_TOP_SPACE, "default");
+		else {
+			string const str = getLengthFromWidgets(
+				column_options_->input_topspace,
+				column_options_->choice_value_topspace);
+			controller().set(LyXTabular::SET_TOP_SPACE, str);
+
+			//check if the input is valid
+			if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+				postWarning(_("Invalid Length (valid example: 10mm)"));
+				return ButtonPolicy::SMI_INVALID;
+			}
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
+	if ((ob == column_options_->input_bottomspace) ||
+	    (ob == column_options_->choice_value_bottomspace)) {
+		string const input = getString(column_options_->input_bottomspace);
+		if (input == "default")
+			controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
+		else {
+			string const str = getLengthFromWidgets(
+				column_options_->input_bottomspace,
+				column_options_->choice_value_bottomspace);
+			controller().set(LyXTabular::SET_BOTTOM_SPACE, str);
+
+			//check if the input is valid
+			if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+				postWarning(_("Invalid Length (valid example: 10mm)"));
+				return ButtonPolicy::SMI_INVALID;
+			}
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
+	if ((ob == column_options_->input_interlinespace) ||
+	    (ob == column_options_->choice_value_interlinespace)) {
+		string const input = getString(column_options_->input_interlinespace);
+		if (input == "default")
+			controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
+		else {
+			string const str = getLengthFromWidgets(
+				column_options_->input_interlinespace,
+				column_options_->choice_value_interlinespace);
+			controller().set(LyXTabular::SET_INTERLINE_SPACE, str);
+
+			//check if the input is valid
+			if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
+				postWarning(_("Invalid Length (valid example: 10mm)"));
+				return ButtonPolicy::SMI_INVALID;
+			}
+		}
+
+		update(); // update for alignment
+		return ButtonPolicy::SMI_VALID;
+	}
+
 	if ((ob == cell_options_->input_mcolumn_width) ||
 	    (ob == cell_options_->choice_value_mcolumn_width)) {
 		string const str =
Index: src/frontends/xforms/forms/form_tabular.fd
===================================================================
--- src/frontends/xforms/forms/form_tabular.fd	(Revision 14175)
+++ src/frontends/xforms/forms/form_tabular.fd	(Arbeitskopie)
@@ -10,13 +10,13 @@ SnapGrid: 5
 =============== FORM ===============
 Name: form_tabular
 Width: 510
-Height: 325
+Height: 400
 Number of Objects: 6
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 510 325
+box: 0 0 510 400
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -34,7 +34,7 @@ argument: 
 --------------------
 class: FL_TABFOLDER
 type: TOP_TABFOLDER
-box: 0 0 505 250
+box: 0 0 505 335
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_TOP_LEFT
@@ -52,7 +52,7 @@ argument: 
 --------------------
 class: FL_BUTTON
 type: NORMAL_BUTTON
-box: 415 290 90 30
+box: 415 365 90 30
 boxtype: FL_UP_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -70,7 +70,7 @@ argument: 0
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 65 290 60 30
+box: 65 365 60 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_TOP_LEFT
@@ -88,7 +88,7 @@ argument: 
 --------------------
 class: FL_INPUT
 type: NORMAL_INPUT
-box: 5 290 60 30
+box: 5 365 60 30
 boxtype: FL_DOWN_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_TOP_LEFT
@@ -328,13 +328,13 @@ argument: 0
 =============== FORM ===============
 Name: form_tabular_column
 Width: 505
-Height: 225
-Number of Objects: 24
+Height: 315
+Number of Objects: 31
 
 --------------------
 class: FL_BOX
 type: FLAT_BOX
-box: 0 0 505 225
+box: 0 0 505 315
 boxtype: FL_FLAT_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_CENTER
@@ -370,6 +370,24 @@ argument: 
 --------------------
 class: FL_LABELFRAME
 type: ENGRAVED_FRAME
+box: 20 230 475 75
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Vertical Space
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
 box: 20 20 170 105
 boxtype: FL_NO_BOX
 colors: FL_BLACK FL_COL1
@@ -765,6 +783,114 @@ name: radio_align_block
 callback: C_FormDialogView_InputCB
 argument: 0
 
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 30 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Top|#T
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_topspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 110 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_topspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 190 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Bottom|#B
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_bottomspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 270 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_bottomspace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 350 270 75 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Interline|#I
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_interlinespace
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 430 270 60 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label:  |#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_value_interlinespace
+callback: C_FormDialogView_InputCB
+argument: 0
+
 =============== FORM ===============
 Name: form_tabular_cell
 Width: 505
Index: src/tabular.C
===================================================================
--- src/tabular.C	(Revision 14175)
+++ src/tabular.C	(Arbeitskopie)
@@ -64,6 +64,8 @@ using std::strlen;
 namespace {
 
 int const WIDTH_OF_LINE = 5;
+int const default_line_space = 10;
+
 
 template <class T>
 string const write_attribute(string const & name, T const & t)
@@ -299,6 +301,21 @@ bool getTokenValue(string const & str, c
 }
 
 
+bool getTokenValue(string const & str, char const * token, LyXLength & len, bool & flag)
+{
+	len = LyXLength();
+	flag = false;
+	string tmp;
+	if (!getTokenValue(str, token, tmp))
+		return false;
+	if (tmp == "default") {
+		flag = true;
+		return  true;
+	}
+	return isValidLength(tmp, &len);
+}
+
+
 void l_getline(istream & is, string & str)
 {
 	str.erase();
@@ -727,9 +744,12 @@ int LyXTabular::getAdditionalHeight(row_
 			top = row_info[row].top_line;
 		}
 	}
+	int const interline_space = row_info[row - 1].interline_space_default ?
+		default_line_space :
+		row_info[row - 1].interline_space.inPixels(width_of_tabular);
 	if (top && bottom)
-		return WIDTH_OF_LINE;
-	return 0;
+		return interline_space + WIDTH_OF_LINE;
+	return interline_space;
 }
 
 
@@ -1225,8 +1245,21 @@ void LyXTabular::write(Buffer const & bu
 	for (row_type i = 0; i < rows_; ++i) {
 		os << "<row"
 		   << write_attribute("topline", row_info[i].top_line)
-		   << write_attribute("bottomline", row_info[i].bottom_line)
-		   << write_attribute("endhead", row_info[i].endhead)
+		   << write_attribute("bottomline", row_info[i].bottom_line);
+		static const string def("default");
+		if (row_info[i].top_space_default)
+			os << write_attribute("topspace", def);
+		else
+			os << write_attribute("topspace", row_info[i].top_space);
+		if (row_info[i].bottom_space_default)
+			os << write_attribute("bottomspace", def);
+		else
+			os << write_attribute("bottomspace", row_info[i].bottom_space);
+		if (row_info[i].interline_space_default)
+			os << write_attribute("interlinespace", def);
+		else
+			os << write_attribute("interlinespace", row_info[i].interline_space);
+		os << write_attribute("endhead", row_info[i].endhead)
 		   << write_attribute("endfirsthead", row_info[i].endfirsthead)
 		   << write_attribute("endfoot", row_info[i].endfoot)
 		   << write_attribute("endlastfoot", row_info[i].endlastfoot)
@@ -1325,6 +1358,12 @@ void LyXTabular::read(Buffer const & buf
 		}
 		getTokenValue(line, "topline", row_info[i].top_line);
 		getTokenValue(line, "bottomline", row_info[i].bottom_line);
+		getTokenValue(line, "topspace", row_info[i].top_space,
+		              row_info[i].top_space_default);
+		getTokenValue(line, "bottomspace", row_info[i].bottom_space,
+		              row_info[i].bottom_space_default);
+		getTokenValue(line, "interlinespace", row_info[i].interline_space,
+		              row_info[i].interline_space_default);
 		getTokenValue(line, "endfirsthead", row_info[i].endfirsthead);
 		getTokenValue(line, "endhead", row_info[i].endhead);
 		getTokenValue(line, "endfoot", row_info[i].endfoot);
@@ -1800,9 +1839,9 @@ int LyXTabular::TeXBottomHLine(ostream &
 			++tmp;
 	}
 	if (use_booktabs && row == rows_ - 1) {
-		os << "\\bottomrule ";
+		os << "\\bottomrule";
 	} else if (tmp == n - fcell) {
-		os << (use_booktabs ? "\\midrule " : "\\hline ");
+		os << (use_booktabs ? "\\midrule" : "\\hline");
 	} else if (tmp) {
 		for (idx_type i = fcell; i < n; ++i) {
 			if (bottomLine(i)) {
@@ -2037,8 +2076,23 @@ int LyXTabular::TeXRow(ostream & os, row
 		       OutputParams const & runparams) const
 {
 	idx_type cell = getCellNumber(i, 0);
-
 	int ret = TeXTopHLine(os, i);
+	if (row_info[i].top_space_default) {
+		if (use_booktabs)
+			os << "\\addlinespace\n";
+		else
+			os << "\\noalign{\\vskip\\doublerulesep}\n";
+	} else if(!row_info[i].top_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace["
+			   << row_info[i].top_space.asLatexString() << "]\n";
+		else {
+			os << "\\noalign{\\vskip"
+			   << row_info[i].top_space.asLatexString() << "}\n";
+		}
+		++ret;
+	}
+	
 	for (col_type j = 0; j < columns_; ++j) {
 		if (isPartOfMultiColumn(i, j))
 			continue;
@@ -2063,9 +2117,36 @@ int LyXTabular::TeXRow(ostream & os, row
 		}
 		++cell;
 	}
-	os << "\\tabularnewline\n";
+	os << "\\tabularnewline";
+	if (row_info[i].bottom_space_default) {
+		if (use_booktabs)
+			os << "\\addlinespace";
+		else
+			os << "[\\doublerulesep]";
+	} else if (!row_info[i].bottom_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace";
+		os << '[' << row_info[i].bottom_space.asLatexString() << ']';
+	}
+	os << '\n';
 	++ret;
 	ret += TeXBottomHLine(os, i);
+	if (row_info[i].interline_space_default) {
+		if (use_booktabs)
+			os << "\\addlinespace\n";
+		else
+			os << "\\noalign{\\vskip\\doublerulesep}\n";
+	} else if (!row_info[i].interline_space.zero()) {
+		if (use_booktabs)
+			os << "\\addlinespace["
+			   << row_info[i].interline_space.asLatexString()
+			   << "]\n";
+		else
+			os << "\\noalign{\\vskip"
+			   << row_info[i].interline_space.asLatexString()
+			   << "}\n";
+		++ret;
+	}
 	return ret;
 }
 
Index: src/tabular.h
===================================================================
--- src/tabular.h	(Revision 14175)
+++ src/tabular.h	(Arbeitskopie)
@@ -131,6 +131,12 @@ public:
 		///
 		UNSET_BOOKTABS,
 		///
+		SET_TOP_SPACE,
+		///
+		SET_BOTTOM_SPACE,
+		///
+		SET_INTERLINE_SPACE,
+		///
 		LAST_ACTION
 	};
 	///
@@ -207,7 +213,8 @@ public:
 	///
 	bool isLastRow(idx_type cell) const;
 
-	///
+	/// return space occupied by the second horizontal line and
+	/// interline space above row \p row in pixels
 	int getAdditionalHeight(row_type row) const;
 	///
 	int getAdditionalWidth(idx_type cell) const;
@@ -466,6 +473,18 @@ public:
 		bool top_line;
 		///
 		bool bottom_line;
+		/// Extra space between the top line and this row
+		LyXLength top_space;
+		/// Ignore top_space if true and use the default top space
+		bool top_space_default;
+		/// Extra space between this row and the bottom line
+		LyXLength bottom_space;
+		/// Ignore bottom_space if true and use the default bottom space
+		bool bottom_space_default;
+		/// Extra space between the bottom line and the next top line
+		LyXLength interline_space;
+		/// Ignore interline_space if true and use the default interline space
+		bool interline_space_default;
 		/// This are for longtabulars only
 		/// a row of endhead
 		bool endhead;
Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py	(Revision 14175)
+++ lib/lyx2lyx/lyx_1_5.py	(Arbeitskopie)
@@ -143,9 +143,9 @@ def revert_font_settings(file):
             file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
             if font_default_family != 'default':
                 file.preamble.append('\\renewcommand{\\familydefault}{\\%s}' % font_default_family)
-           if font_osf == 'true':
+            if font_osf == 'true':
                 file.warning("Ignoring `\\font_osf = true'")
-           return
+            return
     font_scheme = 'default'
     file.header.insert(insert_line, '\\fontscheme %s' % font_scheme)
     if fonts['roman'] == 'cmr':
@@ -176,6 +176,10 @@ def revert_font_settings(file):
 
 def revert_booktabs(file):
 # we just remove the booktabs flag, everything else will become a mess.
+    re_row = re.compile(r'^<row.*space="[^"]+".*>$')
+    re_tspace = re.compile(r'\s+topspace="[^"]+"')
+    re_bspace = re.compile(r'\s+bottomspace="[^"]+"')
+    re_ispace = re.compile(r'\s+interlinespace="[^"]+"')
     i = 0
     while 1:
         i = find_token(file.body, "\\begin_inset Tabular", i)
@@ -189,6 +193,11 @@ def revert_booktabs(file):
             if re.search('^<features.* booktabs="true".*>$', file.body[k]):
                 file.warning("Converting 'booktabs' table to normal table.")
                 file.body[k] = replace(file.body[k], ' booktabs="true"', '')
+            if re.search(re_row, file.body[k]):
+                file.warning("Removing extra row space.")
+                file.body[k] = re_tspace.sub('', file.body[k])
+                file.body[k] = re_bspace.sub('', file.body[k])
+                file.body[k] = re_ispace.sub('', file.body[k])
         i = i + 1
 
 

Reply via email to