]> git.lyx.org Git - features.git/commitdiff
patch from Marko, remove table.Ch from repository
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 20 Sep 2000 16:15:27 +0000 (16:15 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 20 Sep 2000 16:15:27 +0000 (16:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1030 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
po/POTFILES.in
src/Makefile.am
src/frontends/gnome/FormCitation.C
src/frontends/gnome/FormIndex.C
src/frontends/gnome/FormToc.C
src/frontends/gnome/FormUrl.C
src/lyxfunc.C
src/table.C [deleted file]
src/table.h [deleted file]

index c9ea76ce41072752d5ac1668b3078282f97a1017..e51f20cf8af387a29bf4b0bface794d3324b337b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2000-09-20  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/Makefile.am (lyx_SOURCES): remove table.C and Table.h
+
+2000-09-20  Marko Vendelin <markov@ioc.ee>
+
+       * src/frontends/gnome/FormCitation.C
+       * src/frontends/gnome/FormIndex.C
+       * src/frontends/gnome/FormToc.C
+       * src/frontends/gnome/FormUrl.C: cleanup the loops, reordering
+       the variable initialization to shut up the warnings
+
+2000-09-20  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/table.[Ch]: deleted files
+       
+       * src/lyxfunc.C (Dispatch): Don't pass 0 as argument to Dispatch
+       second arg.
+
 2000-09-18  Juergen Vigna  <jug@sad.it>
 
        * src/insets/insettext.C (LocalDispatch): fixed Backspace/Delete
index 901ef1d56b14ad27eb63d3092f6ac5f7fc8016df..f16e40e1c1959acc21e736a5ed313cafdd75c507 100644 (file)
@@ -29,10 +29,11 @@ src/filedlg.C
 src/FontLoader.C
 src/form1.C
 src/frontends/gnome/FormCitation.C
+src/frontends/gnome/FormIndex.C
 src/frontends/gnome/FormPrint.C
 src/frontends/gnome/FormToc.C
-src/frontends/kde/dlg/FormIndex.C
-src/frontends/kde/dlg/formindexdialog.C
+src/frontends/gnome/FormUrl.C
+src/frontends/gnome/Menubar_pimpl.C
 src/frontends/kde/FormCitation.C
 src/frontends/kde/formcitationdialog.C
 src/frontends/kde/FormCopyright.C
@@ -132,7 +133,6 @@ src/support/filetools.C
 src/support/getUserName.C
 src/support/path.C
 src/support/path.h
-src/table.C
 src/TableLayout.C
 src/tabular.C
 src/text2.C
index 935c13d41016d2d99fccdba21ae5dcc805489314..83ef229a09e7e47d7e8edd9ce7de5a77f5344124 100644 (file)
@@ -207,8 +207,6 @@ lyx_SOURCES = \
        spellchecker.C \
        spellchecker.h \
        stl_string_fwd.h \
-       table.h \
-       table.C \
        tabular.C \
        tabular.h \
        tex-accent.C \
index f9defca4906a291349ac6cec9802b865aaaf30e6..d57c028fdcf92f6f909a846f8f6e03ac9880961b 100644 (file)
@@ -78,7 +78,7 @@ static string const CONF_SEARCH("FormCitation_search");
 static string const CONF_TEXTAFTER("FormCitation_textafter");
 
 FormCitation::FormCitation(LyXView * lv, Dialogs * d)
-       : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
+       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
 {
   // let the dialog be shown
   // These are permanent connections so we won't bother
@@ -365,15 +365,13 @@ void FormCitation::showStageSelect()
       gtk_widget_grab_default (GTK_WIDGET(b_ok->gtkobj()));
 
       // setting sizes of the widgets
-      string path;
-      string w, h;
-      path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+      string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+      string w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
 
-      w = path + "/" + CONF_PANE_INFO + CONF_PANE_INFO_DEFAULT;
       paned_info_->set_position( gnome_config_get_int(w.c_str()) );
 
-      int i, sz;
-      for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
+      int sz = clist_bib_->columns().size();
+      for (int i = 0; i < sz; ++i)
        {
          w = path + "/" + CONF_COLUMN + "_" + tostr(i) + CONF_COLUMN_DEFAULT;
          clist_bib_->column(i).set_width( gnome_config_get_int(w.c_str()) );
@@ -392,8 +390,9 @@ void FormCitation::showStageSelect()
                                            false, false));
       // retrieving data
       vector<pair<string,string> > blist = lv_->buffer()->getBibkeyList();
-      
-      for ( i = 0, sz = blist.size(); i < sz; ++i )
+
+      sz = blist.size();
+      for (int i = 0; i < sz; ++i )
        {
          bibkeys.push_back(blist[i].first);
          bibkeysInfo.push_back(blist[i].second);
@@ -566,16 +565,16 @@ void FormCitation::update()
   vector<pair<string,string> > blist =
     lv_->buffer()->getBibkeyList();
 
-  int i, sz;
-  for ( i = 0, sz = blist.size(); i < sz; ++i )
+  int sz = blist.size();
+  for ( int i = 0; i < sz; ++i )
     {
       bibkeys.push_back(blist[i].first);
       bibkeysInfo.push_back(blist[i].second);
     }
 
   blist.clear();
-
-  for ( i = 0, sz = bibkeys.size(); i < sz; ++i )
+  sz = bibkeys.size();
+  for ( int i = 0; i < sz; ++i )
     addItemToBibList(i);
 
   clist_bib_->sort();
@@ -608,9 +607,9 @@ void FormCitation::updateButtons()
   sens = (clist_selected_->selection().size()>0);
   button_unselect_->set_sensitive(sens);
   button_up_->set_sensitive(sens &&
-                           clist_selected_->selection().operator[](0).get_row_num()>0);
+                           clist_selected_->selection()[0].get_row_num()>0);
   button_down_->set_sensitive(sens &&
-                             clist_selected_->selection().operator[](0).get_row_num() <
+                             clist_selected_->selection()[0].get_row_num() <
                              clist_selected_->rows().size()-1);
 
   sens = (clist_bib_->selection().size()>0);
@@ -630,10 +629,9 @@ void FormCitation::selection_toggled(gint            row,
       if (citeselected)
        {
          // lookup the record with the same key in bibkeys and show additional Info
-         int i;
-         int sz = bibkeys.size();
+         int const sz = bibkeys.size();
          string key = clist_selected_->cell(row,0).get_text();
-         for (i=0; !keyfound && i<sz; ++i)
+         for (int i=0; !keyfound && i<sz; ++i)
            if (bibkeys[i] == key)
              {
                info = bibkeysInfo[i];
@@ -660,13 +658,13 @@ void FormCitation::selection_toggled(gint            row,
 
 void FormCitation::removeCitation()
 {
-  clist_selected_->rows().remove(clist_selected_->selection().operator[](0));
+  clist_selected_->rows().remove(clist_selected_->selection()[0]);
   updateButtons();
 }
 
 void FormCitation::moveCitationUp()
 {
-  int i = clist_selected_->selection().operator[](0).get_row_num();
+  int i = clist_selected_->selection()[0].get_row_num();
   clist_selected_->swap_rows( i-1, i );
   clist_selected_->row(i-1).select();
   updateButtons();
@@ -674,7 +672,7 @@ void FormCitation::moveCitationUp()
 
 void FormCitation::moveCitationDown()
 {
-  int i = clist_selected_->selection().operator[](0).get_row_num();
+  int i = clist_selected_->selection()[0].get_row_num();
   clist_selected_->swap_rows( i+1, i );
   clist_selected_->row(i+1).select();
   updateButtons();
@@ -684,7 +682,7 @@ void FormCitation::newCitation()
 {
   // citation key is in the first column of clist_bib_ list
   vector<string> r;
-  r.push_back( clist_bib_->selection().operator[](0).operator[](1).get_text() );
+  r.push_back( clist_bib_->selection()[0][1].get_text() );
   clist_selected_->rows().push_back(r);
   clist_selected_->row( clist_selected_->rows().size()-1 ).select();
   updateButtons();
@@ -741,16 +739,16 @@ void FormCitation::applySelect()
   if( lv_->buffer()->isReadonly() ) return;
 
   string contents;
-  int i, sz;
+  int sz;
 
   contents = frontStrip( strip(params.getContents()) );
   if (!contents.empty()) contents += ", ";
   
   sz = clist_bib_->selection().size();
-  for (i=0; i < sz; ++i)
+  for (int i=0; i < sz; ++i)
     {
       if (i > 0) contents += ", ";
-      contents += clist_bib_->selection().operator[](i).operator[](1).get_text();
+      contents += clist_bib_->selection()[i][1].get_text();
     }
   
   params.setContents( contents );
@@ -768,20 +766,19 @@ void FormCitation::applySelect()
   else
     {
       lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
-                                  params.getAsString().c_str() );
+                                  params.getAsString() );
     }
 
   // save config
   text_after_->save_history();
 
-  string path;
-  string w, h;
-  path  = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+  string path = PACKAGE "/" + LOCAL_CONFIGURE_PREFIX;
+  string w = path + "/" + CONF_PANE_INFO;
 
-  w = path + "/" + CONF_PANE_INFO;
   gnome_config_set_int(w.c_str(), paned_info_->width() - info_->width());
-  
-  for (i = 0, sz = clist_bib_->columns().size(); i < sz; ++i)
+
+  sz = clist_bib_->columns().size();
+  for (int i = 0; i < sz; ++i)
     {
       w = path + "/" + CONF_COLUMN + "_" + tostr(i);
       gnome_config_set_int(w.c_str(), clist_bib_->get_column_width(i));
@@ -798,7 +795,8 @@ void FormCitation::apply()
   if( lv_->buffer()->isReadonly() ) return;
 
   string contents;
-  for( unsigned int i = 0; i < clist_selected_->rows().size(); ++i )
+  int const sz = clist_selected_->rows().size();
+  for( int i = 0; i < sz; ++i )
     {
       if (i > 0) contents += ", ";
       contents += clist_selected_->cell(i, 0).get_text();
@@ -819,7 +817,7 @@ void FormCitation::apply()
   else
     {
       lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
-                                  params.getAsString().c_str() );
+                                  params.getAsString() );
     }
 }
 
@@ -848,9 +846,9 @@ void FormCitation::searchReg()
 
   clist_bib_->freeze();
 
-  int i, sz;
+  int const sz = bibkeys.size();
   bool additem;
-  for ( i = 0, sz = bibkeys.size(); i < sz; ++i )
+  for ( int i = 0; i < sz; ++i )
     {
       string data = bibkeys[i] + bibkeysInfo[i];
 
@@ -882,9 +880,9 @@ void FormCitation::searchSimple()
 
   clist_bib_->freeze();
 
-  int i, sz;
+  int const sz = bibkeys.size();
   bool additem;
-  for ( i = 0, sz = bibkeys.size(); i < sz; ++i )
+  for ( int i = 0; i < sz; ++i )
     {
       string data = bibkeys[i] + bibkeysInfo[i];
 
index a4937692e7418ef6cb7ee2ea7686f4cc874ea1d3..d0749801f23979f392bd4123e82c4338f678048f 100644 (file)
@@ -46,7 +46,7 @@ extern GLyxAppWin * mainAppWin;
 static string const CONF_ENTRY("FormIndex_entry");
 
 FormIndex::FormIndex(LyXView * lv, Dialogs * d)
-       : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
+       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
 {
   // let the dialog be shown
   // These are permanent connections so we won't bother
@@ -187,7 +187,7 @@ void FormIndex::apply()
   else
     {
       lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT,
-                                  params.getAsString().c_str() );
+                                  params.getAsString() );
     }
 
   // save history
index 71c3871871c7cc100301ea318c105d6658c03677..6adbee8497b7b496e03e35633afe343d4cc6257e 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
 using SigC::bind;
 
 FormToc::FormToc(LyXView * lv, Dialogs * d)
-  : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL), ignore_callback_(false)
+  : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL), ignore_callback_(false)
 {
   // let the dialog be shown
   // These are permanent connections so we won't bother
index eadf7ef4b9736c876dedc2b8b18ca4a950974943..fff6d58fb16b3003aaee032748081b555e6895f8 100644 (file)
@@ -39,7 +39,7 @@ static string const CONF_ENTRY_URL("FormUrl_url");
 static string const CONF_ENTRY_NAME("FormUrl_name");
 
 FormUrl::FormUrl(LyXView * lv, Dialogs * d)
-       : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL)
+       : lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(NULL)
 {
   // let the dialog be shown
   // These are permanent connections so we won't bother
@@ -209,7 +209,7 @@ void FormUrl::apply()
   else
     {
       lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL,
-                                  params.getAsString().c_str() );
+                                  params.getAsString() );
     }
 
   // save history
index 5c6eece450d21a820e797518a324d35a5c30c503..80e2de3a0e7f8a85ca08d5d3869cb63fabe0beb8 100644 (file)
@@ -893,7 +893,7 @@ string const LyXFunc::Dispatch(int ac,
                meta_fake_bit = 0;
                if(owner->view()->available())
                        // cancel any selection
-                       Dispatch(LFUN_MARK_OFF, 0);
+                       Dispatch(LFUN_MARK_OFF);
                setMessage(N_("Cancel"));
                break;
 
diff --git a/src/table.C b/src/table.C
deleted file mode 100644 (file)
index 6de4bf9..0000000
+++ /dev/null
@@ -1,2080 +0,0 @@
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
- *      
- *       Copyright 1995 Matthias Ettrich
- *        Copyright 1995-2000 The LyX Team.
- *
- * ====================================================== 
- */
-
-#include <config.h>
-
-#include <algorithm>
-#include <cstdlib>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "table.h"
-#include "debug.h"
-#include "vspace.h"
-#include "layout.h"
-#include "support/lstrings.h"
-#include "support/lyxmanip.h"
-#include "support/LAssert.h"
-#include "lyx_gui_misc.h"
-
-using std::ostream;
-using std::istream;
-using std::getline;
-using std::max;
-using std::endl;
-
-static int const WIDTH_OF_LINE = 5;
-
-/// Define a few methods for the inner structs
-
-LyXTable::cellstruct::cellstruct() 
-{
-       cellno = 0; //should be initilaized correctly later.
-       width_of_cell = 0;
-       multicolumn = LyXTable::CELL_NORMAL;
-       alignment = LYX_ALIGN_CENTER;
-       top_line = true;
-       bottom_line = false;
-       has_cont_row = false;
-       rotate = false;
-       linebreaks = false;
-}
-
-LyXTable::cellstruct::~cellstruct() 
-{
-}
-
-LyXTable::cellstruct & 
-  LyXTable::cellstruct::operator=(cellstruct const & cs)
-{
-       cellno = cs.cellno;
-       width_of_cell = cs.width_of_cell;
-       multicolumn = cs.multicolumn;
-       alignment = cs.alignment;
-       top_line = cs.top_line;
-       bottom_line = cs.bottom_line;
-       has_cont_row = cs.has_cont_row;
-       rotate = cs.rotate;
-       linebreaks = cs.linebreaks;
-       return *this;
-}
-
-LyXTable::rowstruct::rowstruct() 
-{
-       top_line = true;
-       bottom_line = false;
-       is_cont_row = false;
-       ascent_of_row = 0;
-       descent_of_row = 0;
-       newpage = false;
-}
-
-// Nothing to do, but gcc 2.7.2.3 wants one... (JMarc)
-LyXTable::rowstruct::~rowstruct() 
-{
-}
-
-LyXTable::rowstruct & 
-LyXTable::rowstruct::operator=(rowstruct const & rs)
-{
-       top_line = rs.top_line;
-       bottom_line = rs.bottom_line;
-       is_cont_row = rs.is_cont_row;
-       ascent_of_row = rs.ascent_of_row;
-       descent_of_row = rs.descent_of_row;
-       newpage = rs.newpage;
-       return *this;
-}
-
-LyXTable::columnstruct::columnstruct() 
-{
-        left_line = true;
-        right_line = false;
-        alignment = LYX_ALIGN_CENTER;
-        width_of_column = 0;
-}
-
-LyXTable::columnstruct::~columnstruct() 
-{
-}
-
-LyXTable::columnstruct & 
-LyXTable::columnstruct::operator=(columnstruct const & cs)
-{
-        left_line = cs.left_line;
-        right_line = cs.right_line;
-        alignment = cs.alignment;
-        width_of_column = cs.width_of_column;
-       p_width = cs.p_width;
-       align_special = cs.align_special;
-       return *this;
-}
-
-/* konstruktor */
-LyXTable::LyXTable(int rows_arg, int columns_arg)
-{
-    Init(rows_arg, columns_arg);
-}
-
-
-LyXTable::LyXTable(LyXTable const & lt)
-{
-    Init(lt.rows, lt.columns);
-    
-    operator=(lt);
-}
-
-LyXTable::LyXTable(LyXLex & lex)
-{
-    istream & is = lex.getStream();
-    Read(is);
-}
-
-
-LyXTable::~LyXTable()
-{
-    delete[] rowofcell;
-    delete[] columnofcell;
-    delete[] column_info;
-    delete[] row_info;
-    for (int i = 0; i < rows; ++i) {
-       delete[] cell_info[i];
-    }
-    delete[] cell_info;
-}
-
-
-LyXTable & LyXTable::operator=(LyXTable const & lt)
-{
-    // If this and lt is not of the same size we have a serious bug
-    // So then it is ok to throw an exception, or for now
-    // call abort()
-    Assert(rows == lt.rows && columns == lt.columns);
-
-    int row = 0, column = 0;
-    
-    for (row = 0; row < rows; ++row) {
-        for (column = 0; column < columns; ++column) {
-            cell_info[row][column] = lt.cell_info[row][column];
-        }
-    }
-    
-    for (row = 0; row < rows; ++row) {
-        row_info[row] = lt.row_info[row];
-    }
-    
-    for (column = 0; column < columns; ++column) {
-       column_info[column] = lt.column_info[column];
-    }
-
-    SetLongTable(lt.is_long_table);
-    rotate = lt.rotate;
-    Reinit();
-    
-    return *this;
-}
-
-LyXTable * LyXTable::Clone()
-{
-    LyXTable * result = new LyXTable(rows, columns);
-    int row, column;
-
-    for (row = 0; row < rows; ++row) {
-        for (column = 0; column < columns; ++column) {
-            result->cell_info[row][column] = cell_info[row][column];
-        }
-    }
-
-    for (row = 0; row < rows; ++row) {
-        result->row_info[row] = row_info[row];
-    }
-
-    for (column = 0; column < columns; ++column) {
-        result->column_info[column].left_line = column_info[column].left_line;
-        result->column_info[column].right_line = column_info[column].right_line;
-        result->column_info[column].alignment = column_info[column].alignment;
-        result->column_info[column].p_width = column_info[column].p_width;
-        result->column_info[column].align_special = column_info[column].align_special;
-    }
-  
-    result->SetLongTable(is_long_table);
-    result->rotate = rotate;
-    result->Reinit();
-    return result;
-}
-
-
-/* activates all lines and sets all widths to 0 */ 
-void LyXTable::Init(int rows_arg, int columns_arg)
-{
-    int i, j;
-    rows = rows_arg;
-    columns = columns_arg;
-    column_info = new columnstruct[columns];
-    row_info = new rowstruct[rows];
-    cell_info = new cellstruct*[rows];
-
-    int cellno = 0;
-    for (i = 0; i < rows; ++i) {
-        cell_info[i] = new cellstruct[columns];
-        for (j = 0; j < columns; ++j) {
-            cell_info[i][j].cellno = cellno++;
-        }
-    }
-    row_info[i-1].bottom_line = true;
-    row_info[0].bottom_line = true;
-
-    for (i = 0; i < columns; ++i) {
-        calculate_width_of_column(i);
-    }
-    column_info[i-1].right_line = true;
-   
-    calculate_width_of_table();
-
-    rowofcell = 0;
-    columnofcell = 0;
-    set_row_column_number_info();
-    is_long_table = false;
-    rotate = 0;
-    endhead = -1;
-    endfirsthead = -1;
-    endfoot = -1;
-    endlastfoot = -1;
-}
-
-
-void LyXTable::AppendRow(int cell)
-{
-    int row = row_of_cell(cell);
-    rowstruct * row_info2 = new rowstruct[rows + 1];
-    cellstruct ** cell_info2 = new cellstruct * [rows + 1];
-    int i;
-
-    for (i = 0; i <= row; ++i) {
-        cell_info2[i] = cell_info[i];
-        row_info2[i] = row_info[i];
-    }
-    for (i = rows - 1; i >= row; --i) {
-        cell_info2[i + 1] = cell_info[i];
-        row_info2[i + 1] = row_info[i];
-    }
-    for (i = row; row_info[i].is_cont_row; --i);
-    if (((row + 1) >= rows) || !row_info[row + 1].is_cont_row)
-        row_info2[row + 1].is_cont_row = false;
-    row_info2[row + 1].top_line = row_info[i].top_line;
-    cell_info2[row + 1] = new cellstruct[columns];
-    for (i = 0; i < columns; ++i) {
-        cell_info2[row + 1][i].width_of_cell = 0;
-        cell_info2[row + 1][i] = cell_info2[row][i];
-    }
-   
-    delete[] cell_info;
-    cell_info = cell_info2;
-    delete[] row_info;
-    row_info = row_info2;
-   
-    ++rows;
-   
-    Reinit();
-}
-
-
-void LyXTable::DeleteRow(int cell)
-{
-       int row = row_of_cell(cell);
-        while(!row_info[row].is_cont_row && RowHasContRow(cell))
-            DeleteRow(cell_info[row+1][0].cellno);
-        rowstruct * row_info2 = new rowstruct[rows - 1];
-       cellstruct ** cell_info2 = new cellstruct * [rows - 1];
-
-       delete[] cell_info[row];
-       int i = 0;
-       for (; i < row; ++i) {
-               cell_info2[i] = cell_info[i];
-                row_info2[i] = row_info[i];
-       }
-        if (row_info[i].is_cont_row)
-            row_info2[i - 1].bottom_line = row_info[i].bottom_line;
-       for (i = row; i < rows - 1; ++i) {
-               cell_info2[i] = cell_info[i + 1];
-                row_info2[i] = row_info[i + 1];
-       }
-
-       delete[] cell_info;
-       cell_info = cell_info2;
-        delete[] row_info;
-        row_info = row_info2;
-   
-       --rows;
-
-       Reinit();
-}
-
-
-void LyXTable::AppendColumn(int cell)
-{
-    int j;
-    columnstruct * column_info2 = new columnstruct[columns + 1];
-    int column = right_column_of_cell(cell);
-
-    int i = 0;
-    for (; i <= column; ++i) {
-        column_info2[i] = column_info[i];
-    }
-    for (i = columns - 1; i >= column; --i) {
-        column_info2[i + 1] = column_info[i];
-    }
-    
-    delete[] column_info;
-    column_info = column_info2;
-    
-    for (i = 0; i < rows; ++i) {
-        cellstruct * tmp = cell_info[i];
-        cell_info[i] = new cellstruct[columns + 1];
-        for (j = 0; j <= column; ++j) {
-            cell_info[i][j] = tmp[j];
-        }
-        for (j = column; j < columns; ++j) {
-            cell_info[i][j + 1] = tmp[j];
-        }
-        // care about multicolumns
-        if (cell_info[i][column + 1].multicolumn
-            == LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
-            cell_info[i][column + 1].multicolumn = 
-                LyXTable::CELL_PART_OF_MULTICOLUMN;
-        }
-        if (column + 1 == columns
-            || cell_info[i][column + 2].multicolumn
-            != LyXTable::CELL_PART_OF_MULTICOLUMN){
-            cell_info[i][column + 1].multicolumn = 
-                LyXTable::CELL_NORMAL;
-        }
-        delete[] tmp;
-    }
-    
-    ++columns;
-    Reinit();
-}
-
-
-void LyXTable::Reinit()
-{   
-       int j;
-
-       int i = 0;
-       for (; i < rows; ++i) {
-               for (j = 0; j < columns; ++j) {
-                       cell_info[i][j].width_of_cell = 0;
-                        if ((i + 1 < rows) && !row_info[i+1].is_cont_row)
-                            cell_info[i][j].has_cont_row = false;
-               }
-       }
-  
-       for (i = 0; i < columns; ++i) {
-               calculate_width_of_column(i);
-       }
-       calculate_width_of_table();
-
-       set_row_column_number_info();
-}
-
-
-void LyXTable::set_row_column_number_info()
-{
-       int c = 0;
-       int column = 0;
-       numberofcells = -1;
-       int row = 0;
-       for (; row < rows; ++row) {
-               for (column = 0; column<columns; ++column) {
-                       if (cell_info[row][column].multicolumn
-                           != LyXTable::CELL_PART_OF_MULTICOLUMN)
-                               ++numberofcells;
-                        cell_info[row][column].cellno = numberofcells;
-               }
-       }
-       ++numberofcells; // because this is one more than as we start from 0
-       row = 0;
-       column = 0;
-
-       delete [] rowofcell;
-       rowofcell = new int[numberofcells];
-       delete [] columnofcell;
-       columnofcell = new int[numberofcells];
-  
-       while (c < numberofcells && row < rows && column < columns) {
-               rowofcell[c] = row;
-               columnofcell[c] = column;
-               ++c;
-               do {
-                       ++column;
-               } while (column < columns &&
-                        cell_info[row][column].multicolumn
-                        == LyXTable::CELL_PART_OF_MULTICOLUMN);
-               if (column == columns) {
-                       column = 0;
-                       ++row;
-               }
-       }
-}
-
-
-void LyXTable::DeleteColumn(int cell)
-{
-       int column1 = column_of_cell(cell);
-       int column2 = right_column_of_cell(cell);
-   
-       if (column1 == 0 && column2 == columns - 1)
-               return;
-   
-       for (int column = column1; column <= column2; ++column) {
-               delete_column(column1);
-       }
-       Reinit();
-}
-
-
-int LyXTable::GetNumberOfCells()
-{
-       return numberofcells;
-}
-
-
-int LyXTable::NumberOfCellsInRow(int cell)
-{
-       int row = row_of_cell(cell);
-       int result = 0;
-       for (int i = 0; i < columns; ++i) {
-               if (cell_info[row][i].multicolumn != LyXTable::CELL_PART_OF_MULTICOLUMN)
-                       ++result;
-       }
-       return result;
-}
-
-
-int LyXTable::AppendCellAfterCell(int append_cell, int question_cell)
-{
-       return (right_column_of_cell(append_cell) == 
-               right_column_of_cell(question_cell));
-}
-
-
-int LyXTable::DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell)
-{
-    if (column_of_cell(delete_column_cell) == 0 && 
-        right_column_of_cell(delete_column_cell) == columns - 1)
-        return 0;
-    else
-        return
-            (column_of_cell(cell) >= column_of_cell(delete_column_cell) &&
-             column_of_cell(cell) <= right_column_of_cell(delete_column_cell));
-}
-
-
-/* returns 1 if there is a topline, returns 0 if not */ 
-bool LyXTable::TopLine(int cell)
-{
-    int row = row_of_cell(cell);
-    
-    if (IsContRow(cell))
-        return TopLine(cell_info[row-1][column_of_cell(cell)].cellno);
-    if (IsMultiColumn(cell))
-        return cellinfo_of_cell(cell)->top_line;
-    return row_info[row].top_line;
-}
-
-
-bool LyXTable::BottomLine(int cell)
-{
-    //no bottom line underneath non-existent cells if you please
-    if(cell >= numberofcells)
-       return false;
-
-    int row = row_of_cell(cell);
-    
-    if (RowHasContRow(cell))
-        return BottomLine(cell_info[row+1][column_of_cell(cell)].cellno);
-    if (IsMultiColumn(cell))
-        return cellinfo_of_cell(cell)->bottom_line;
-    return row_info[row_of_cell(cell)].bottom_line;
-}
-
-
-bool LyXTable::LeftLine(int cell)
-{
-       return column_info[column_of_cell(cell)].left_line;
-}
-
-
-bool LyXTable::RightLine(int cell)
-{
-       return column_info[right_column_of_cell(cell)].right_line;
-}
-
-
-bool LyXTable::TopAlreadyDrawed(int cell)
-{
-       if (AdditionalHeight(cell))
-               return false;
-       int row = row_of_cell(cell);
-       if (row > 0){
-               int column = column_of_cell(cell);
-               while (column
-                      && cell_info[row-1][column].multicolumn
-                      == LyXTable::CELL_PART_OF_MULTICOLUMN)
-                       --column;
-               if (cell_info[row-1][column].multicolumn
-                   == LyXTable::CELL_NORMAL)
-                       return row_info[row-1].bottom_line;
-               else
-                       return cell_info[row-1][column].bottom_line;
-       }
-       return false;
-}
-
-
-bool LyXTable::VeryLastRow(int cell)
-{
-       return (row_of_cell(cell) == rows - 1);
-}
-
-
-int LyXTable::AdditionalHeight(int cell)
-{
-       int row = row_of_cell(cell);
-       if (!row) return 0;
-       
-       int top = 1; // bool top = true; ??
-       int bottom = 1; // bool bottom = true; ??
-       int column;
-
-       for (column = 0; column < columns - 1 && bottom; ++column) {
-               switch (cell_info[row - 1][column].multicolumn) {
-               case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
-                       bottom = cell_info[row - 1][column].bottom_line;
-                       break;
-               case LyXTable::CELL_NORMAL:
-                       bottom = row_info[row - 1].bottom_line;
-               }
-       }
-       for (column = 0; column < columns - 1 && top; ++column) {
-               switch (cell_info[row][column].multicolumn){
-               case LyXTable::CELL_BEGIN_OF_MULTICOLUMN:
-                       top = cell_info[row][column].top_line;
-                       break;
-               case LyXTable::CELL_NORMAL:
-                       top = row_info[row].top_line;
-               }
-       }
-       if (top && bottom)
-               return WIDTH_OF_LINE;
-       return 0;
-}
-
-
-int LyXTable::AdditionalWidth(int cell)
-{
-       // internally already set in SetWidthOfCell
-       // used to get it back in text.C
-       int col = right_column_of_cell(cell);
-       if (col < columns - 1 && column_info[col].right_line &&
-            column_info[col+1].left_line)
-               return WIDTH_OF_LINE;
-       else
-               return 0;
-}
-
-
-// returns the maximum over all rows 
-int LyXTable::WidthOfColumn(int cell)
-{
-       int column1 = column_of_cell(cell);
-       int column2 = right_column_of_cell(cell);
-       int result = 0;
-       int i = column1;
-       for (; i <= column2; ++i) {
-               result += column_info[i].width_of_column;
-       }
-       return result;
-}
-
-
-int LyXTable::WidthOfTable()
-{
-       return width_of_table;
-}
-
-/* returns 1 if a complete update is necessary, otherwise 0 */ 
-bool LyXTable::SetWidthOfMulticolCell(int cell, int new_width)
-{
-    if (!IsMultiColumn(cell))
-        return false;
-    
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
-    int column2 = right_column_of_cell(cell);
-
-    // first set columns to 0 so we can calculate the right width
-    int i = column1;
-    for (; i <= column2; ++i) {
-        cell_info[row][i].width_of_cell = 0;
-    }
-    // set the width to MAX_WIDTH until width > 0
-    int width = (new_width + 2 * WIDTH_OF_LINE);
-    for (i = column1; (i < column2) && (width > 0); ++i) {
-        cell_info[row][i].width_of_cell = column_info[i].width_of_column;
-        width -= column_info[i].width_of_column;
-    }
-    if (i == column2) {
-        cell_info[row][i].width_of_cell = width;
-    }
-    return true;
-}
-
-
-void LyXTable::recalculateMulticolCells(int cell, int new_width)
-{
-       int row = row_of_cell(cell);
-       int column1 = column_of_cell(cell);
-        int column2 = right_column_of_cell(cell);
-
-    // first set columns to 0 so we can calculate the right width
-        int i = column1;
-    for (; i <= column2; ++i)
-        cell_info[row][i].width_of_cell = 0;
-    for(i = cell + 1; (i < numberofcells) && (!IsMultiColumn(i)); ++i)
-        ;
-    if (i < numberofcells)
-        recalculateMulticolCells(i, GetWidthOfCell(i) - (2 * WIDTH_OF_LINE));
-    SetWidthOfMulticolCell(cell, new_width);
-}
-
-
-/* returns 1 if a complete update is necessary, otherwise 0 */ 
-bool LyXTable::SetWidthOfCell(int cell, int new_width)
-{
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
-    int tmp = 0;
-    int width = 0;
-
-    if (IsMultiColumn(cell)) {
-        tmp = SetWidthOfMulticolCell(cell, new_width);
-    } else {
-       width = (new_width + 2*WIDTH_OF_LINE);
-        cell_info[row][column1].width_of_cell = width;
-        if (column_info[column1].right_line && (column1 < columns-1) &&
-            column_info[column1+1].left_line) // additional width
-            cell_info[row][column1].width_of_cell += WIDTH_OF_LINE;
-        tmp = calculate_width_of_column_NMC(column1);
-    }
-    if (tmp) {
-        int i;
-        for(i = 0; i<columns;++i)
-            calculate_width_of_column_NMC(i);
-        for(i = 0; (i<numberofcells) && !IsMultiColumn(i); ++i)
-            ;
-        if (i<numberofcells)
-            recalculateMulticolCells(i, GetWidthOfCell(i)-(2*WIDTH_OF_LINE));
-        for(i = 0; i<columns;++i)
-            calculate_width_of_column(i);
-        calculate_width_of_table();
-        return true;
-    }
-    return false;
-}
-
-
-bool LyXTable::SetAlignment(int cell, char align)
-{
-    if (!IsMultiColumn(cell))
-        column_info[column_of_cell(cell)].alignment = align;
-    cellinfo_of_cell(cell)->alignment = align;
-    return true;
-}
-
-bool LyXTable::SetPWidth(int cell, string width)
-{
-    int fvcell = FirstVirtualCell(cell);
-
-    if (IsMultiColumn(fvcell)) {
-//        if (column_info[column_of_cell(cell)].p_width.empty())
-//            column_info[column_of_cell(cell)].p_width = width;
-        cellinfo_of_cell(fvcell)->p_width = width;
-    } else {
-        column_info[column_of_cell(fvcell)].p_width = width;
-       if (!width.empty()) // do this only if there is a width
-               SetAlignment(cell, LYX_ALIGN_LEFT);
-    }
-    return true;
-}
-
-bool LyXTable::SetAlignSpecial(int cell, string special, int what)
-{
-    if (what == SET_SPECIAL_MULTI)
-        cellinfo_of_cell(cell)->align_special = special;
-    else
-        column_info[column_of_cell(cell)].align_special = special;
-    return true;
-}
-
-bool LyXTable::SetAllLines(int cell, bool line)
-{
-    SetTopLine(cell, line);
-    SetBottomLine(cell, line);
-    SetRightLine(cell, line);
-    SetLeftLine(cell, line);
-    return true;
-}
-
-bool LyXTable::SetTopLine(int cell, bool line)
-{
-    int row = row_of_cell(cell);
-
-    if (IsContRow(cell))
-        SetTopLine(cell_info[row-1][column_of_cell(cell)].cellno, line);
-    else if (!IsMultiColumn(cell))
-        row_info[row].top_line = line;
-    else
-        cellinfo_of_cell(cell)->top_line = line;
-    return true;
-}
-
-
-bool LyXTable::SetBottomLine(int cell, bool line)
-{
-    int row = row_of_cell(cell);
-
-    if (RowHasContRow(cell))
-        SetBottomLine(cell_info[row+1][column_of_cell(cell)].cellno, line);
-    else if (!IsMultiColumn(cell))
-        row_info[row_of_cell(cell)].bottom_line = line;
-    else
-        cellinfo_of_cell(cell)->bottom_line = line;
-    return true;
-}
-
-
-bool LyXTable::SetLeftLine(int cell, bool line)
-{
-       column_info[column_of_cell(cell)].left_line = line;
-       return true;
-}
-
-
-bool LyXTable::SetRightLine(int cell, bool line)
-{
-       column_info[right_column_of_cell(cell)].right_line = line;
-       return true;
-}
-
-
-char LyXTable::GetAlignment(int cell)
-{
-       if (IsMultiColumn(cell))
-               return cellinfo_of_cell(cell)->alignment;
-       else
-               return column_info[column_of_cell(cell)].alignment;
-}
-
-string const LyXTable::GetPWidth(int cell)
-{
-       int fvcell = FirstVirtualCell(cell);
-       
-       if (IsMultiColumn(fvcell)) // && !cellinfo_of_cell(cell)->p_width.empty())
-               return cellinfo_of_cell(fvcell)->p_width;
-       return column_info[column_of_cell(fvcell)].p_width;
-}
-
-string const LyXTable::GetAlignSpecial(int cell, int what)
-{
-    if (what == SET_SPECIAL_MULTI)
-        return cellinfo_of_cell(cell)->align_special;
-    return column_info[column_of_cell(cell)].align_special;
-}
-
-int LyXTable::GetWidthOfCell(int cell)
-{
-       int row = row_of_cell(cell);
-       int column1 = column_of_cell(cell);
-       int column2 = right_column_of_cell(cell);
-       int result = 0;
-       int i = column1;
-       for (; i <= column2; ++i) {
-               result += cell_info[row][i].width_of_cell;
-       }
-  
-       result += AdditionalWidth(cell);
-  
-       return result;
-}
-
-
-int LyXTable::GetBeginningOfTextInCell(int cell)
-{
-       int x = 0;
-   
-       switch (GetAlignment(cell)){
-       case LYX_ALIGN_CENTER:
-               x += (WidthOfColumn(cell) - GetWidthOfCell(cell)) / 2;
-               break;
-       case LYX_ALIGN_RIGHT:
-               x += WidthOfColumn(cell) - GetWidthOfCell(cell) + AdditionalWidth(cell);
-               break;
-       default: /* LYX_ALIGN_LEFT: nothing :-) */ 
-               break;
-       }
-
-       // the LaTeX Way :-(
-       x += WIDTH_OF_LINE;
-       return x;
-}
-
-
-bool LyXTable::IsFirstCell(int cell)
-{
-       return (column_of_cell(cell) == 0);
-}
-
-bool LyXTable::IsLastCell(int cell)
-{
-       return (right_column_of_cell(cell) == (columns - 1));
-}
-
-
-bool LyXTable::calculate_width_of_column(int column)
-{
-       int old_column_width = column_info[column].width_of_column;
-       int maximum = 0;
-
-       for (int i = 0; i < rows; ++i) {
-               maximum = max(cell_info[i][column].width_of_cell, maximum);
-       }
-       column_info[column].width_of_column = maximum;
-       return (column_info[column].width_of_column != old_column_width);
-}
-
-bool LyXTable::calculate_width_of_column_NMC(int column)
-{
-    int old_column_width = column_info[column].width_of_column;
-    int max = 0;
-    for (int i = 0; i < rows; ++i) {
-        if (!IsMultiColumn(GetCellNumber(column, i)) &&
-            (cell_info[i][column].width_of_cell > max)) {
-            max = cell_info[i][column].width_of_cell;
-        }
-    }
-    column_info[column].width_of_column = max;
-    return (column_info[column].width_of_column != old_column_width);
-}
-
-void LyXTable::calculate_width_of_table()
-{
-       width_of_table = 0;
-       for (int i = 0; i < columns; ++i) {
-               width_of_table += column_info[i].width_of_column;
-       }
-}
-
-
-int LyXTable::row_of_cell(int cell) const
-{
-    if (cell >= numberofcells)
-        return rows-1;
-    else if (cell < 0)
-        return 0;
-    return rowofcell[cell];
-}
-
-
-int LyXTable::column_of_cell(int cell) const
-{
-    if (cell >= numberofcells)
-        return columns-1;
-    else if (cell < 0)
-        return 0;
-    return columnofcell[cell];
-}
-
-
-int LyXTable::right_column_of_cell(int cell) 
-{
-       int row = row_of_cell(cell);
-       int column = column_of_cell(cell);
-       while (column < columns - 1 &&
-              cell_info[row][column+1].multicolumn == LyXTable::CELL_PART_OF_MULTICOLUMN)
-               ++column;
-       return column;
-}
-
-
-void LyXTable::Write(ostream & os, bool old_format)
-{
-    if (old_format) {
-       int i, j;
-       os << "multicol5\n"
-          << rows << " " << columns << " " << is_long_table << " "
-          << rotate << " " << endhead << " " << endfirsthead << " "
-          << endfoot << " " << endlastfoot << "\n";
-       for (i = 0; i < rows; ++i) {
-           os << row_info[i].top_line << " "
-              << row_info[i].bottom_line << " "
-              << row_info[i].is_cont_row << " "
-              << row_info[i].newpage << "\n";
-       }
-       for (i = 0; i < columns; ++i) {
-           os << column_info[i].alignment << " "
-              << column_info[i].left_line << " "
-              << column_info[i].right_line << " \""
-              << VSpace(column_info[i].p_width).asLyXCommand() << "\" \""
-              << column_info[i].align_special << "\"\n";
-       }
-
-       for (i = 0; i < rows; ++i) {
-           for (j = 0; j < columns; ++j) {
-               os << cell_info[i][j].multicolumn << " "
-                  << cell_info[i][j].alignment << " "
-                  << cell_info[i][j].top_line << " "
-                  << cell_info[i][j].bottom_line << " "
-                  << cell_info[i][j].has_cont_row << " "
-                  << cell_info[i][j].rotate << " "
-                  << cell_info[i][j].linebreaks << " \""
-                  << cell_info[i][j].align_special << "\" \""
-                  << cell_info[i][j].p_width << "\"\n";
-           }
-       }
-    } else {
-       lyxerr << "New format type not yet implemented!!!\n" << endl;
-    }
-}
-
-
-void LyXTable::Read(istream & is)
-{
-       int version;
-       int i, j;
-       int rows_arg = 0;
-       int columns_arg = 0;
-       int is_long_table_arg = false;
-       int rotate_arg = false;
-       int a = -1;
-       int b = -1;
-       int c = -1;
-       int d = -1;
-       int e = 0;
-       int f = 0;
-       int g = 0;
-       int h = 0;
-       
-       string s;
-       while(!s.length())
-           getline(is, s);
-       if (s.length() > 8)
-               version = atoi(s.c_str() + 8);
-       else
-               version = 1;
-       if (version < 5) {
-               lyxerr << "Tabular format < 5 is not supported anymore\n"
-                       "Get an older version of LyX (< 1.1.x) for conversion!"
-                      << endl;
-               WriteAlert(_("Warning:"),
-                          _("Tabular format < 5 is not supported anymore\n"),
-                          _("Get an older version of LyX (< 1.1.x) for conversion!"));
-               if (version > 2) {
-                       is >> rows_arg >> columns_arg >> is_long_table_arg
-                          >> rotate_arg >> a >> b >> c >> d;
-               } else
-                       is >> rows_arg >> columns_arg;
-               Init(rows_arg, columns_arg);
-               SetLongTable(is_long_table_arg);
-               SetRotateTable(rotate_arg);
-               string tmp;
-               for (i = 0; i < rows; ++i) {
-                       getline(is, tmp);
-               }
-               for (i = 0; i < columns; ++i) {
-                       getline(is, tmp);
-               }
-               for (i = 0; i < rows; ++i) {
-                       for (j = 0; j < columns; ++j) {
-                               getline(is, tmp);
-                       }
-               }
-               set_row_column_number_info();
-               return;
-       }
-       is >> rows_arg >> columns_arg >> is_long_table_arg
-          >> rotate_arg >> a >> b >> c >> d;
-       Init(rows_arg, columns_arg);
-       SetLongTable(is_long_table_arg);
-       SetRotateTable(rotate_arg);
-       endhead = a;
-       endfirsthead = b;
-       endfoot = c;
-       endlastfoot = d;
-       for (i = 0; i < rows; ++i) {
-               a = b = c = d = e = f = g = h = 0;
-               is >> a >> b >> c >> d;
-               row_info[i].top_line = a;
-               row_info[i].bottom_line = b;
-               row_info[i].is_cont_row = c;
-               row_info[i].newpage = d;
-       }
-       for (i = 0; i < columns; ++i) {
-               string s1;
-               string s2;
-               is >> a >> b >> c;
-               char ch; // skip '"'
-               is >> ch;
-               getline(is, s1, '"');
-               is >> ch; // skip '"'
-               getline(is, s2, '"');
-               column_info[i].alignment = static_cast<char>(a);
-               column_info[i].left_line = b;
-               column_info[i].right_line = c;
-               column_info[i].p_width = s1;
-               column_info[i].align_special = s2;
-       }
-       for (i = 0; i < rows; ++i) {
-               for (j = 0; j < columns; ++j) {
-                       string s1;
-                       string s2;
-                       is >> a >> b >> c >> d >> e >> f >> g;
-                       char ch;
-                       is >> ch; // skip '"'
-                       getline(is, s1, '"');
-                       is >> ch; // skip '"'
-                       getline(is, s2, '"');
-                       cell_info[i][j].multicolumn = static_cast<char>(a);
-                       cell_info[i][j].alignment = static_cast<char>(b);
-                       cell_info[i][j].top_line = static_cast<char>(c);
-                       cell_info[i][j].bottom_line = static_cast<char>(d);
-                       cell_info[i][j].has_cont_row = static_cast<bool>(e);
-                       cell_info[i][j].rotate = static_cast<bool>(f);
-                       cell_info[i][j].linebreaks = static_cast<bool>(g);
-                       cell_info[i][j].align_special = s1;
-                       cell_info[i][j].p_width = s2;
-               }
-       }
-       set_row_column_number_info();
-}
-
-
-// cell <0 will tex the preamble
-// returns the number of printed newlines
-int LyXTable::TexEndOfCell(ostream & os, int cell)
-{
-    int i;
-    int ret = 0;
-    int tmp; // tmp2;
-    int fcell, nvcell;
-    if (ShouldBeVeryLastCell(cell)) {
-        // the very end at the very beginning
-        if (Linebreaks(cell))
-               os << "\\smallskip{}}";
-        if (IsMultiColumn(cell))
-               os << '}';
-        if (RotateCell(cell)) {
-               os << "\n\\end{sideways}";
-            ++ret;
-        }
-        os << "\\\\\n";
-        ++ret;
-    
-        tmp = 0;
-        fcell = cell; 
-        while (!IsFirstCell(fcell)) --fcell;
-        for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-            if (BottomLine(fcell + i))
-                ++tmp;
-        }
-        if (tmp == NumberOfCellsInRow(fcell)) {
-               os << "\\hline ";
-        } else {
-            tmp = 0;
-            for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                if (BottomLine(fcell + i)) {
-                       os << "\\cline{"
-                          << column_of_cell(fcell + i) + 1
-                          << '-'
-                          << right_column_of_cell(fcell + i) + 1
-                          << "} ";
-                    tmp = 1;
-                }
-            }
-        }
-        if (tmp){
-               os << '\n';
-            ++ret;
-        }
-        if (is_long_table)
-               os << "\\end{longtable}";
-        else
-               os << "\\end{tabular}";
-        if (rotate) {
-               os << "\n\\end{sideways}";
-            ++ret;
-        }
-    } else {
-        nvcell = NextVirtualCell(cell + 1);
-        if (cell < 0){
-            // preamble
-            if (rotate) {
-                   os << "\\begin{sideways}\n";
-                ++ret;
-            }
-            if (is_long_table)
-                   os << "\\begin{longtable}{";
-            else
-                   os << "\\begin{tabular}{";
-            for (i = 0; i < columns; ++i) {
-                if (column_info[i].left_line)
-                       os << '|';
-                if (!column_info[i].align_special.empty()) {
-                       os << column_info[i].align_special;
-                } else if (!column_info[i].p_width.empty()) {
-                       os << "p{"
-                          << column_info[i].p_width
-                          << '}';
-                } else {
-                    switch (column_info[i].alignment) {
-                      case LYX_ALIGN_LEFT:
-                             os << 'l';
-                          break;
-                      case LYX_ALIGN_RIGHT:
-                             os << 'r';
-                          break;
-                      default:
-                             os << 'c';
-                          break;
-                    }
-                }
-                if (column_info[i].right_line)
-                       os << '|';
-            }
-            os << "}\n";
-            ++ret;
-            tmp = 0;
-            if (GetNumberOfCells()) {
-                fcell = 0;
-                for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                    if (TopLine(fcell + i))
-                        ++tmp;
-                }
-                if (tmp == NumberOfCellsInRow(fcell)){
-                       os << "\\hline ";
-                } else {
-                    tmp = 0;
-                    for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                        if (TopLine(fcell + i)) {
-                               os << "\\cline{"
-                                  << column_of_cell(fcell + i) + 1
-                                  << '-'
-                                  << right_column_of_cell(fcell + i) + 1
-                                  << "} ";
-                               tmp = 1;
-                        }
-                    }
-                }
-                if (tmp){
-                       os << '\n';
-                    ++ret;
-                }
-            }
-            if (RotateCell(0)) {
-                   os << "\\begin{sideways}\n";
-                ++ret;
-            }
-        } else {
-            // usual cells
-            if (Linebreaks(cell))
-                   os << "\\smallskip{}}";
-            if (IsMultiColumn(cell)){
-                   os << '}';
-            }
-            if (RotateCell(cell)) {
-                   os << "\n\\end{sideways}";
-                ++ret;
-            }
-            if (IsLastCell(cell)) {
-                int row = row_of_cell(cell);
-                string hline1, hline2;
-                bool print_hline = true;
-                bool flag1 = IsLongTable() &&
-                    ((row == endhead) || (row == endfirsthead) ||
-                     (row == endfoot) || (row == endlastfoot));
-                ++row;
-                bool flag2 = IsLongTable() &&
-                    ((row <= endhead) || (row <= endfirsthead) ||
-                     (row <= endfoot) || (row <= endlastfoot));
-                --row;
-                // print the bottom hline only if (otherwise it is doubled):
-                // - is no LongTable
-                // - there IS a first-header
-                // - the next row is no special header/footer
-                //   & this row is no special header/footer
-                // - the next row is a special header/footer
-                //   & this row is a special header/footer
-                bool pr_top_hline = (flag1 && flag2) || (!flag1 && !flag2) ||
-                    (endfirsthead == endhead);
-                os << "\\\\\n";
-                ++ret;
-                tmp = 0;
-                fcell = cell;
-                while (!IsFirstCell(fcell))
-                    --fcell;
-                for (i = 0; i < NumberOfCellsInRow(cell); ++i) {
-                    if (BottomLine(fcell + i))
-                        ++tmp;
-                }
-                if (tmp == NumberOfCellsInRow(cell)){
-                       os << "\\hline ";
-                    hline1 = "\\hline ";
-                } else {
-                    tmp = 0;
-                    for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                        if (BottomLine(fcell + i)){
-                               os << "\\cline{"
-                                  << column_of_cell(fcell + i) + 1
-                                  << '-'
-                                  << right_column_of_cell(fcell + i) + 1
-                                  << "} ";
-                            hline1 += "\\cline{";
-                            hline1 += tostr(column_of_cell(fcell + i) + 1);
-                            hline1 += '-';
-                            hline1 += tostr(right_column_of_cell(fcell + i) + 1);
-                            hline1 += "} ";
-                            tmp = 1;
-                        }
-                    }
-                }
-                if (tmp){
-                       os << '\n';
-                    ++ret;
-                }
-                if (IsLongTable() && (row == endfoot)) {
-                       os << "\\endfoot\n";
-                    ++ret;
-                    print_hline = false; // no double line below footer
-                }
-                if (IsLongTable() && (row == endlastfoot)) {
-                       os << "\\endlastfoot\n";
-                    ++ret;
-                    print_hline = false; // no double line below footer
-                }
-                if (IsLongTable() && row_info[row].newpage) {
-                       os << "\\newpage\n";
-                    ++ret;
-                    print_hline = false; // no line below a \\newpage-command
-                }
-                tmp = 0;
-                if (nvcell < numberofcells
-                   && (cell < GetNumberOfCells() - 1)
-                    && !ShouldBeVeryLastCell(cell)) {
-                    fcell = nvcell;
-                    for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                        if (TopLine(fcell + i))
-                            ++tmp;
-                    }
-                    if (tmp == NumberOfCellsInRow(fcell)) {
-                        if (print_hline)
-                               os << "\\hline ";
-                        hline2 = "\\hline ";
-                    } else {
-                        tmp = 0;
-                        for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
-                            if (TopLine(fcell + i)) {
-                                if (print_hline) {
-                                       os << "\\cline{"
-                                          << column_of_cell(fcell + i) + 1
-                                          << '-'
-                                          << right_column_of_cell(fcell + i) + 1
-                                          << "} ";
-                               }
-                                hline2 += "\\cline{";
-                                hline2 += tostr(column_of_cell(fcell+i)+1);
-                                hline2 += '-';
-                                hline2 += tostr(right_column_of_cell(fcell+i)+1);
-                                hline2 += "} ";
-                                tmp = 1;
-                            }
-                        }
-                    }
-                    if (tmp && print_hline){
-                           os << '\n';
-                        ++ret;
-                    }
-                }
-                // the order here is important as if one defines two
-                // or more things in one line only the first entry is
-                // displayed the other are set to an empty-row. This
-                // is important if I have a footer and want that the
-                // lastfooter is NOT displayed!!!
-                bool sflag2 = (row == endhead) || (row == endfirsthead) ||
-                    (row == endfoot) || (row == endlastfoot);
-                --row;
-//                sflag2 = IsLongTable() && (row >= 0) &&
-//                    (sflag2 || (row == endhead) || (row == endfirsthead));
-                row += 2;
-                bool sflag1 = IsLongTable() && (row != endhead) &&
-                    (row != endfirsthead) &&
-                    ((row == endfoot) || (row == endlastfoot));
-                --row;
-                if (IsLongTable() && (row == endhead)) {
-                       os << "\\endhead\n";
-                    ++ret;
-                }
-                if (IsLongTable() && (row == endfirsthead)) {
-                       os << "\\endfirsthead\n";
-                    ++ret;
-                }
-                if (sflag1) { // add the \hline for next foot row
-                    if (!hline1.empty()) {
-                           os << hline1 + '\n';
-                        ++ret;
-                    }
-                }
-                // add the \hline for the first row
-                if (pr_top_hline && sflag2) {
-                    if (!hline2.empty()) {
-                           os << hline2 + '\n';
-                        ++ret;
-                    }
-                }
-                if (nvcell < numberofcells && RotateCell(nvcell)) {
-                       os << "\\begin{sideways}\n";
-                    ++ret;
-                }
-            } else {
-                   os << "&\n";
-                ++ret;
-                if (nvcell < numberofcells && RotateCell(nvcell)) {
-                       os << "\\begin{sideways}\n";
-                    ++ret;
-                }
-            }
-        }
-        if (nvcell < numberofcells && IsMultiColumn(nvcell)) {
-               os << "\\multicolumn{"
-                  << cells_in_multicolumn(nvcell)
-                  << "}{";
-            if (!cellinfo_of_cell(nvcell)->align_special.empty()) {
-                   os << cellinfo_of_cell(nvcell)->align_special
-                      << "}{";
-            } else {
-                if (LeftLine(nvcell))
-                       os << '|';
-                if (!GetPWidth(nvcell).empty()) {
-                       os << "p{"
-                          << GetPWidth(nvcell)
-                          << '}';
-                } else {
-                    switch (GetAlignment(nvcell)) {
-                   case LYX_ALIGN_LEFT: os << 'l'; break;
-                   case LYX_ALIGN_RIGHT: os << 'r'; break;
-                   default:  os << 'c'; break;
-                    }
-                }
-                if (RightLine(nvcell))
-                       os << '|';
-                //if (column_of_cell(cell+2)!= 0 && LeftLine(cell+2))
-                if (((nvcell + 1) < numberofcells) &&
-                    (NextVirtualCell(nvcell+1) < numberofcells) &&
-                    (column_of_cell(NextVirtualCell(nvcell+1))!= 0) &&
-                    LeftLine(NextVirtualCell(nvcell+1)))
-                       os << '|';
-               
-               os << "}{";
-            }
-        }
-        if (nvcell < numberofcells && Linebreaks(nvcell)) {
-               os << "\\parbox[t]{"
-                  << GetPWidth(nvcell)
-                  << "}{\\smallskip{}";
-       }
-    }
-    return ret;
-}
-
-
-#if 0
-// cell <0 will tex the preamble
-// returns the number of printed newlines
-int LyXTable::RoffEndOfCell(ostream & os, int cell)
-{
-    int ret = 0;
-
-    if (cell == GetNumberOfCells() - 1){
-        // the very end at the very beginning
-        if (CellHasContRow(cell) >= 0) {
-               os << "\nT}";
-            ++ret;
-        }
-        os << "\n";
-        ++ret;
-        if (row_info[row_of_cell(cell)].bottom_line) {
-               os << "_\n";
-            ++ret;
-        }
-        os << ".TE\n.pl 1c";
-    } else {  
-        if (cell < 0) {
-            int fcell = 0;
-            // preamble
-            os << "\n.pl 500c\n.TS\n";
-            for (int j = 0; j < rows; ++j) {
-                for (int i = 0; i < columns; ++i, ++fcell) {
-                    if (column_info[i].left_line)
-                           os << " | ";
-                    if (cell_info[j][i].multicolumn == CELL_PART_OF_MULTICOLUMN)
-                           os << "s";
-                    else {
-                        switch (column_info[i].alignment) {
-                          case LYX_ALIGN_LEFT:
-                                 os << "l";
-                              break;
-                          case LYX_ALIGN_RIGHT:
-                                 os << "r";
-                              break;
-                          default:
-                                 os << "c";
-                              break;
-                        }
-                    }
-                    if (!column_info[i].p_width.empty())
-                           os << "w(" << column_info[i].p_width << ")";
-                    if (column_info[i].right_line)
-                           os << " | ";
-                }
-                if ((j + 1) < rows) {
-                       os << "\n";
-                    ++ret;
-                }
-            }
-            os << ".\n";
-            ++ret;
-            if (row_info[0].top_line) {
-                   os << "_\n";
-                ++ret;
-            }
-            if (CellHasContRow(0) >= 0) {
-                   os << "T{\n";
-                ++ret;
-            }
-        } else {
-            // usual cells
-            if (CellHasContRow(cell) >= 0) {
-                   os << "\nT}";
-                ++ret;
-            }
-            if (right_column_of_cell(cell) == columns -1){
-                   os << "\n";
-                ++ret;
-                int row = row_of_cell(cell);
-                if (row_info[row++].bottom_line) {
-                       os << "_\n";
-                    ++ret;
-                }
-                if ((row < rows) && row_info[row].top_line) {
-                       os << "_\n";
-                    ++ret;
-                }
-            } else
-                   os << "\t";
-            if ((cell < GetNumberOfCells() - 1) &&
-                (CellHasContRow(cell+1) >= 0)) {
-                   os << "T{\n";
-                ++ret;
-            }
-        }
-    }
-    return ret;
-}
-#endif
-
-
-char const *LyXTable::getDocBookAlign(int cell, bool isColumn)
-{
-    int i;
-    if (isColumn)
-       i = cell;
-    else
-       i = column_of_cell(cell);
-    if (!isColumn && IsMultiColumn(cell)) {
-       if (!cellinfo_of_cell(cell)->align_special.empty()) {
-           return cellinfo_of_cell(cell)->align_special.c_str();
-       } else {
-           switch (GetAlignment(cell)) {
-           case LYX_ALIGN_LEFT:
-               return "left";
-           case LYX_ALIGN_RIGHT:
-               return "right";
-           default:
-               return "center";
-           }
-       }
-    } else {
-       if (!column_info[i].align_special.empty()) {
-           return column_info[i].align_special.c_str();
-       }
-#ifdef IGNORE_THIS_FOR_NOW
-       else if (!column_info[i].p_width.empty()) {
-           file += "p{";
-           file += column_info[i].p_width;
-           file += '}';
-       }
-#endif
-       else {
-           switch (column_info[i].alignment) {
-           case LYX_ALIGN_LEFT:
-               return "left";
-           case LYX_ALIGN_RIGHT:
-               return "right";
-           default:
-               return "center";
-           }
-       }
-    }
-}
-
-
-// cell <0 will tex the preamble
-// returns the number of printed newlines
-int LyXTable::DocBookEndOfCell(ostream & os, int cell, int & depth)
-{
-    int i;
-    int ret = 0;
-    //int tmp; // tmp2; // unused
-    int nvcell; // fcell; // unused
-    if (ShouldBeVeryLastCell(cell)) {
-           os << newlineAndDepth(--depth)
-              << "</ENTRY>"
-              << newlineAndDepth(--depth)
-              << "</ROW>"
-              << newlineAndDepth(--depth)
-              << "</TBODY>"
-              << newlineAndDepth(--depth);
-        if (is_long_table)
-               os << "</TGROUP>";
-        else
-               os << "</TGROUP>"
-                  << newlineAndDepth(--depth);
-        ret += 4;
-    } else {
-        nvcell = NextVirtualCell(cell + 1);
-        if (cell < 0) {
-            // preamble
-            if (is_long_table)
-                   os << "<TGROUP ";
-            else
-                   os << "<TGROUP ";
-            os << "COLS='"
-              << columns
-              << "' COLSEP='1' ROWSEP='1'>"
-              << newlineAndDepth(++depth);
-            ++ret;
-            for (i = 0; i < columns; ++i) {
-                   os << "<COLSPEC ALIGN='"
-                      << getDocBookAlign(i, true)
-                      << "' COLNAME='col"
-                      << i + 1
-                      << "' COLNUM='"
-                      << i + 1
-                      << "' COLSEP='";
-               if (i == (columns-1)) {
-                      os << '1';
-               } else {
-                   if (column_info[i].right_line ||
-                       column_info[i+1].left_line)
-                          os << '1';
-                   else
-                          os << '0';
-               }
-               os << "'>"
-                 << newlineAndDepth(depth);
-                ++ret;
-#ifdef NOT_HANDLED_YET_AS_I_DONT_KNOW_HOW
-                if (column_info[i].left_line)
-                       os << '|';
-#endif
-            }
-            os << "<TBODY>"
-              << newlineAndDepth(++depth)
-              << "<ROW>"
-              << newlineAndDepth(++depth)
-              << "<ENTRY ALIGN='"
-              << getDocBookAlign(0)
-              << "'";
-           if (IsMultiColumn(0)) {
-                  os << " NAMEST='col1' NAMEEND='col"
-                     << cells_in_multicolumn(0)
-                     << "'";
-           }
-          os << ">"
-             << newlineAndDepth(++depth);
-            ret += 3;
-        } else {
-            if (IsLastCell(cell)) {
-                   os << newlineAndDepth(--depth)
-                      << "</ENTRY>"
-                      << newlineAndDepth(--depth)
-                      << "</ROW>"
-                      << newlineAndDepth(depth)
-                      << "<ROW>"
-                      << newlineAndDepth(++depth)
-                      << "<ENTRY ALIGN='"
-                      << getDocBookAlign(cell + 1)
-                      << "' VALIGN='middle'";
-               if (IsMultiColumn(cell + 1)) {
-                      os << " NAMEST='col"
-                         << column_of_cell(cell+1) + 1
-                         << "' NAMEEND='col"
-                         << column_of_cell(cell + 1) +
-                              cells_in_multicolumn(cell + 1)
-                         << "'";
-               }
-               os << ">"
-                 << newlineAndDepth(++depth);
-                ret += 4;
-            } else {
-                   os << newlineAndDepth(--depth)
-                      << "</ENTRY>"
-                      << newlineAndDepth(depth)
-                      << "<ENTRY ALIGN='"
-                      << getDocBookAlign(cell + 1)
-                      << "' VALIGN='middle'";
-               if (IsMultiColumn(cell + 1)) {
-                      os << " NAMEST='col"
-                         << column_of_cell(cell+1) + 1
-                         << "' NAMEEND='col"
-                         << column_of_cell(cell+1) +
-                              cells_in_multicolumn(cell+1)
-                         << "'";
-               }
-               os << ">"
-                 << newlineAndDepth(++depth);
-                ret += 3;
-            }
-        }
-    }
-    return ret;
-}
-
-
-bool LyXTable::IsMultiColumn(int cell)
-{
-    int fvcell = FirstVirtualCell(cell);
-
-    return (cellinfo_of_cell(fvcell)->multicolumn != LyXTable::CELL_NORMAL);
-}
-
-
-LyXTable::cellstruct* LyXTable::cellinfo_of_cell(int cell)
-{
-    int row = row_of_cell(cell);
-    int column = column_of_cell(cell);
-    return  &cell_info[row][column];
-}
-   
-
-void LyXTable::SetMultiColumn(int cell, int number)
-{
-    int fvcell = FirstVirtualCell(cell);
-    int new_width = cellinfo_of_cell(fvcell)->width_of_cell;
-    
-    cellinfo_of_cell(fvcell)->multicolumn = LyXTable::CELL_BEGIN_OF_MULTICOLUMN;
-    cellinfo_of_cell(fvcell)->alignment = column_info[column_of_cell(fvcell)].alignment;
-    cellinfo_of_cell(fvcell)->top_line = row_info[row_of_cell(fvcell)].top_line;
-    cellinfo_of_cell(fvcell)->bottom_line = row_info[row_of_cell(fvcell)].bottom_line;
-    for (number--; number > 0; --number) {
-        cellinfo_of_cell(fvcell+number)->multicolumn = 
-            LyXTable::CELL_PART_OF_MULTICOLUMN;
-        new_width += cellinfo_of_cell(fvcell+number)->width_of_cell;
-    }
-    set_row_column_number_info();
-    SetWidthOfCell(fvcell, new_width);
-}
-
-
-int LyXTable::cells_in_multicolumn(int cell)
-{
-    int row = row_of_cell(cell);
-    int column = column_of_cell(cell);
-    int result = 1;
-    ++column;
-    while (column < columns && cell_info[row][column].multicolumn
-           == LyXTable::CELL_PART_OF_MULTICOLUMN){
-        ++result;
-        ++column;
-    }
-    return result;
-}
-
-
-int  LyXTable::UnsetMultiColumn(int cell)
-{
-    int fvcell = FirstVirtualCell(cell);
-    int row = row_of_cell(fvcell);
-    int column = column_of_cell(fvcell);
-    
-    int result = 0;
-    
-    if (cell_info[row][column].multicolumn
-        == LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
-        cell_info[row][column].multicolumn = LyXTable::CELL_NORMAL;
-        ++column;
-        while (column < columns &&
-               cell_info[row][column].multicolumn
-               == LyXTable::CELL_PART_OF_MULTICOLUMN){
-            cell_info[row][column].multicolumn = 
-                LyXTable::CELL_NORMAL;
-            ++column;
-            ++result;
-        }
-    }
-    set_row_column_number_info();
-    return result;
-}
-
-
-void LyXTable::delete_column(int column)
-{
-    int i, j;
-    columnstruct * column_info2 = new columnstruct[columns-1];
-   
-    for (i = 0; i < column; ++i) {
-        column_info2[i] = column_info[i];
-    }
-    for (i = column; i < columns - 1; ++i) {
-        column_info2[i] = column_info[i + 1];
-    }
-   
-    delete[] column_info;
-    column_info = column_info2;
-
-    for (i = 0; i < rows; ++i) {
-        cellstruct * tmp = cell_info[i];
-        cell_info[i] = new cellstruct[columns - 1];
-        for (j = 0; j < column; ++j) {
-            cell_info[i][j] = tmp[j];
-        }
-        for (j = column; j < columns - 1; ++j) {
-            cell_info[i][j] = tmp[j + 1];
-        }
-        delete[] tmp;
-    }
-
-    --columns;
-    Reinit();
-}
-
-
-void LyXTable::SetLongTable(int what)
-{
-    is_long_table = what;
-}
-
-
-bool LyXTable::IsLongTable()
-{
-    return is_long_table;
-}
-
-void LyXTable::SetRotateTable(int what)
-{
-    rotate = what;
-}
-
-bool LyXTable::RotateTable()
-{
-    return rotate;
-}
-
-void LyXTable::SetRotateCell(int cell, int what)
-{
-    cellinfo_of_cell(cell)->rotate = what;
-}
-
-bool LyXTable::RotateCell(int cell)
-{
-    return cellinfo_of_cell(cell)->rotate;
-}
-
-bool LyXTable::NeedRotating()
-{
-    if (rotate)
-        return true;
-    for (int i = 0; i < rows; ++i) {
-        for (int j = 0; j < columns; ++j) {
-            if (cell_info[i][j].rotate)
-                return true;
-        }
-    }
-    return false;
-}
-
-void LyXTable::AppendContRow(int cell)
-{
-    int row = row_of_cell(cell)+1;
-
-    if (!RowHasContRow(cell) || (CellHasContRow(cell)>= 0))
-        AppendRow(cell);
-    row_info[row].is_cont_row = true;
-    row_info[row].top_line = false;
-    cell_info[row-1][column_of_cell(cell)].has_cont_row = true;
-    Reinit();
-}
-
-bool LyXTable::IsContRow(int cell)
-{
-    return row_info[row_of_cell(cell)].is_cont_row;
-}
-
-int LyXTable::CellHasContRow(int cell)
-{
-    int row = row_of_cell(cell);
-
-    if (VeryLastRow(cell))
-        return -1;
-    if (cell_info[row][column_of_cell(cell)].has_cont_row)
-        return cell_info[row+1][column_of_cell(cell)].cellno;
-    return -1;
-}
-
-bool LyXTable::RowHasContRow(int cell)
-{
-    int row = row_of_cell(cell) + 1;
-
-    if (row < rows)
-        return row_info[row].is_cont_row;
-    return false;
-}
-
-int LyXTable::FirstVirtualCell(int cell)
-{
-    if (!IsContRow(cell))
-        return cell;
-    int row = row_of_cell(cell);
-    int column = column_of_cell(cell);
-    for(; (row > 0) && IsContRow(cell_info[row][column].cellno); --row)
-        ;
-    return cell_info[row][column].cellno;
-}
-
-
-int LyXTable::NextVirtualCell(int cell)
-{
-    if (!IsContRow(cell))
-        return cell;
-    int row = row_of_cell(cell);
-    for(;(row < rows - 1) && IsContRow(cell_info[row][0].cellno); ++row)
-       ;
-    // what if(row >= rows) ?
-    return cell_info[row][0].cellno;
-}
-
-
-bool LyXTable::ShouldBeVeryLastCell(int cell)
-// "very last cell" ..of what? the row? the table?
-// "Cell" in this context appears to not count `virtual' cells
-{
-    int fcell = cell + 1;
-
-    if (cell == GetNumberOfCells() - 1)
-        return true; // not really sure if I should return false here
-    if (!IsContRow(fcell))
-        return false;
-    while((fcell < GetNumberOfCells() - 1) && IsContRow(fcell))
-        ++fcell;
-    if (fcell < GetNumberOfCells() - 1)
-        return false;
-    return true;
-}
-
-bool LyXTable::ShouldBeVeryLastRow(int cell)
-{
-    if (CellHasContRow(cell)>= 0)
-        return false;
-    int row = row_of_cell(cell) + 1;
-    int column = column_of_cell(cell);
-    while((row < rows) && IsContRow(cell_info[row][column].cellno))
-        ++row;
-    if (row < rows)
-        return false; // found another valid row
-    // I do not have any valid row after the actual
-    return true;
-}
-
-int LyXTable::GetCellAbove(int cell)
-{
-    int row = row_of_cell(cell);
-    
-    if (row > 0)
-        return cell_info[row-1][column_of_cell(cell)].cellno;
-    return cell;
-}
-
-int LyXTable::GetCellNumber(int column, int row)
-{
-    if (column >= columns)
-        column = columns - 1;
-    else if (column < 0)
-        column = 0;
-    if (row >= rows)
-        row = rows - 1;
-    else if (row < 0)
-        row = 0;
-    
-    return cell_info[row][column].cellno;
-}
-
-void LyXTable::SetLinebreaks(int cell, bool what)
-{
-    cellinfo_of_cell(FirstVirtualCell(cell))->linebreaks = what;
-}
-
-bool LyXTable::Linebreaks(int cell)
-{
-    int fvcell = FirstVirtualCell(cell);
-
-    if (column_info[column_of_cell(fvcell)].p_width.empty() &&
-        !(IsMultiColumn(fvcell) && !cellinfo_of_cell(fvcell)->p_width.empty()))
-        return false;
-    return cellinfo_of_cell(fvcell)->linebreaks;
-}
-
-void LyXTable::SetLTHead(int cell, bool first)
-{
-    int row = row_of_cell(cell);
-
-    if (first) {
-        if (row == endfirsthead)
-            endfirsthead = -1;
-        else
-            endfirsthead = row;
-    } else {
-        if (row == endhead)
-            endhead = -1;
-        else
-            endhead = row;
-    }
-}
-
-bool LyXTable::RowOfLTHead(int cell)
-{
-    if ((endhead+1) > rows)
-        endhead = -1;
-    return (row_of_cell(cell) == endhead);
-}
-
-bool LyXTable::RowOfLTFirstHead(int cell)
-{
-    if ((endfirsthead+1) > rows)
-        endfirsthead = -1;
-    return (row_of_cell(cell) == endfirsthead);
-}
-
-void LyXTable::SetLTFoot(int cell, bool last)
-{
-    int row = row_of_cell(cell);
-
-    if (last) {
-        if (row == endlastfoot)
-            endlastfoot = -1;
-        else
-            endlastfoot = row;
-    } else {
-        if (row == endfoot)
-            endfoot = -1;
-        else
-            endfoot = row;
-    }
-}
-
-bool LyXTable::RowOfLTFoot(int cell)
-{
-    if ((endfoot+1) > rows) {
-        endfoot = -1;
-        return false;
-    }
-    return (row_of_cell(cell) == endfoot);
-}
-
-bool LyXTable::RowOfLTLastFoot(int cell)
-{
-    if ((endlastfoot+1) > rows)
-        endlastfoot = -1;
-    return (row_of_cell(cell) == endlastfoot);
-}
-
-void LyXTable::SetLTNewPage(int cell, bool what)
-{
-    row_info[row_of_cell(cell)].newpage = what;
-}
-
-bool LyXTable::LTNewPage(int cell)
-{
-    return row_info[row_of_cell(cell)].newpage;
-}
-
-void LyXTable::SetAscentOfRow(int row, int height)
-{
-    if (row >= rows)
-        return;
-    row_info[row].ascent_of_row = height;
-}
-
-void LyXTable::SetDescentOfRow(int row, int height)
-{
-    if (row >= rows)
-        return;
-    row_info[row].descent_of_row = height;
-}
-
-int LyXTable::AscentOfRow(int row)
-{
-    if (row >= rows)
-        return 0;
-    return row_info[row].ascent_of_row;
-}
-
-int LyXTable::DescentOfRow(int row)
-{
-    if (row >= rows)
-        return 0;
-    return row_info[row].descent_of_row;
-}
-
-int LyXTable::HeightOfTable()
-{
-    int
-        height,
-        row;
-
-    for(row=0,height=0;(row<rows); ++row)
-        height += AscentOfRow(row) + DescentOfRow(row) +
-           AdditionalHeight(GetCellNumber(0,row));
-    return height;
-}
-
-bool LyXTable::IsPartOfMultiColumn(int row, int column)
-{
-    if ((row >= rows) || (column >= columns))
-        return false;
-    return (cell_info[row][column].multicolumn==CELL_PART_OF_MULTICOLUMN);
-}
-
-int LyXTable::Latex(ostream &)
-{
-    return 0;
-}
diff --git a/src/table.h b/src/table.h
deleted file mode 100644 (file)
index 27c9b7c..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-// -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
- *      
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
- *
- * ====================================================== */
-#ifndef TABLE_H
-#define TABLE_H
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include <iosfwd>
-
-#include "lyxlex.h"
-#include "LString.h"
-
-/* The features the text class offers for tables */ 
-
-///
-class LyXTable  {
-public:
-    // Are the values of these enums important? (Lgb)
-    ///
-    enum {
-       ///
-       APPEND_ROW = 0,
-       ///
-       APPEND_COLUMN = 1,
-       ///
-       DELETE_ROW = 2,
-       ///
-       DELETE_COLUMN = 3,
-       ///
-       TOGGLE_LINE_TOP = 4,
-       ///
-       TOGGLE_LINE_BOTTOM = 5,
-       ///
-       TOGGLE_LINE_LEFT = 6,
-       ///
-       TOGGLE_LINE_RIGHT = 7,
-       ///
-       ALIGN_LEFT = 8, // what are these alignment enums used for?
-       ///
-       ALIGN_RIGHT = 9,
-       ///
-       ALIGN_CENTER = 10,
-       ///
-       DELETE_TABLE = 11,
-       ///
-       MULTICOLUMN = 12,
-       ///
-       SET_ALL_LINES = 13,
-       ///
-       UNSET_ALL_LINES = 14,
-       ///
-       SET_LONGTABLE = 15,
-       ///
-       UNSET_LONGTABLE = 16,
-       ///
-       SET_PWIDTH = 17,
-       ///
-       APPEND_CONT_ROW = 18,
-       ///
-       SET_ROTATE_TABLE = 19,
-       ///
-       UNSET_ROTATE_TABLE = 20,
-       ///
-       SET_ROTATE_CELL = 21,
-       ///
-       UNSET_ROTATE_CELL = 22,
-       ///
-       SET_LINEBREAKS = 23,
-       ///
-       SET_LTHEAD = 24,
-       ///
-       SET_LTFIRSTHEAD = 25,
-       ///
-       SET_LTFOOT = 26,
-       ///
-       SET_LTLASTFOOT = 27,
-       ///
-       SET_LTNEWPAGE = 28,
-       ///
-       SET_SPECIAL_COLUMN = 29,
-       ///
-       SET_SPECIAL_MULTI = 30
-    };
-    ///
-    enum {
-       ///
-       CELL_NORMAL = 0,
-       ///
-       CELL_BEGIN_OF_MULTICOLUMN = 1,
-       ///
-       CELL_PART_OF_MULTICOLUMN = 2
-    };
-    /* konstruktor */
-    ///
-    LyXTable(int columns_arg, int rows_arg);
-    ///
-    LyXTable(LyXTable const &);
-    ///
-    explicit
-    LyXTable(LyXLex & lex);
-    ///
-    ~LyXTable();
-    ///
-    LyXTable & operator=(LyXTable const &);
-    ///
-    LyXTable * Clone();
-    
-    /// Returns true if there is a topline, returns false if not
-    bool TopLine(int cell);
-    /// Returns true if there is a topline, returns false if not
-    bool BottomLine(int cell);
-    /// Returns true if there is a topline, returns false if not
-    bool LeftLine(int cell);
-    /// Returns true if there is a topline, returns false if not
-    bool RightLine(int cell);
-    
-    ///
-    bool TopAlreadyDrawed(int cell);
-    ///
-    bool VeryLastRow(int cell);
-    
-    ///
-    int AdditionalHeight(int cell);
-    ///
-    int AdditionalWidth(int cell);
-    
-    /* returns the maximum over all rows */
-    ///
-    int WidthOfColumn(int cell);
-    ///
-    int WidthOfTable();
-    ///
-    int AscentOfRow(int row);
-    ///
-    int DescentOfRow(int row);
-    ///
-    int HeightOfTable();
-    ///
-    void SetAscentOfRow(int row, int height);
-    ///
-    void SetDescentOfRow(int row, int height);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetWidthOfCell(int cell, int new_width);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetAllLines(int cell, bool line);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetTopLine(int cell, bool line);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetBottomLine(int cell, bool line);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetLeftLine(int cell, bool line);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetRightLine(int cell, bool line);
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetAlignment(int cell, char align);
-    ///
-    bool SetPWidth(int cell, string width);
-    ///
-    bool SetAlignSpecial(int cell, string special, int what);
-    ///
-    char GetAlignment(int cell); // add approp. signedness
-    ///
-    string const GetPWidth(int cell);
-    ///
-    string const GetAlignSpecial(int cell, int what);
-    
-    ///
-    int GetWidthOfCell(int cell);
-    ///
-    int GetBeginningOfTextInCell(int cell);
-    
-    ///
-    void AppendRow(int cell);
-    ///
-    void DeleteRow(int cell);
-    
-    ///
-    void AppendColumn(int cell);
-    ///
-    void DeleteColumn(int cell);
-    
-    ///
-    bool IsFirstCell(int cell);
-    ///
-    bool IsLastCell(int cell);
-    
-    ///
-    int GetNumberOfCells();
-    ///
-    int AppendCellAfterCell(int append_cell, int question_cell);
-    ///
-    int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
-    ///
-    int NumberOfCellsInRow(int cell);
-    ///
-    void Reinit();
-
-    ///
-    void Init(int columns_arg, int rows_arg);
-
-    ///
-    void Write(std::ostream &, bool old_format=true);
-    ///
-    void Read(std::istream &);
-    ///
-    int Latex(std::ostream &);
-
-    /**
-       @param cell < 0 will tex the preamble
-       @return the number of printed newlines
-    */
-    int TexEndOfCell(std::ostream &, int cell);
-    ///
-    int DocBookEndOfCell(std::ostream &, int cell, int & depth);
-
-#if 0
-    ///
-    int RoffEndOfCell(std::ostream &, int cell);
-#endif
-
-    ///
-    char const * getDocBookAlign(int cell, bool isColumn = false);
-
-    ///
-    bool IsMultiColumn(int cell);
-    ///
-    void SetMultiColumn(int cell, int number);
-    ///
-    int UnsetMultiColumn(int cell); // returns number of new cells
-    ///
-    bool IsPartOfMultiColumn(int row, int column);
-    ///
-    int row_of_cell(int cell) const;
-    ///
-    int column_of_cell(int cell) const;
-    ///
-    int rows;
-    ///
-    int columns;
-    ///
-    void SetLongTable(int what);
-    ///
-    bool IsLongTable();
-    ///
-    void SetRotateTable(int what);
-    ///
-    bool RotateTable();
-    ///
-    void SetRotateCell(int cell, int what);
-    ///
-    bool RotateCell(int cell);
-    ///
-    bool NeedRotating();
-    ///
-    void AppendContRow(int cell);
-    ///
-    bool IsContRow(int cell);
-    /**
-       @return number of the cell which coninues or -1 if no ContRow
-    */
-    int CellHasContRow(int cell);
-    ///
-    bool RowHasContRow(int cell);
-    ///
-    int FirstVirtualCell(int cell);
-    ///
-    int NextVirtualCell(int cell);
-    ///
-    bool ShouldBeVeryLastCell(int cell);
-    ///
-    bool ShouldBeVeryLastRow(int cell);
-    ///
-    int GetCellAbove(int cell);
-    ///
-    int GetCellNumber(int column, int row);
-    ///
-    void SetLinebreaks(int cell, bool what);
-    ///
-    bool Linebreaks(int cell);
-    //
-    // Long Table Options
-    ///
-    void SetLTHead(int cell, bool first);
-    ///
-    bool RowOfLTHead(int cell);
-    ///
-    bool RowOfLTFirstHead(int cell);
-    ///
-    void SetLTFoot(int cell, bool last);
-    ///
-    bool RowOfLTFoot(int cell);
-    ///
-    bool RowOfLTLastFoot(int cell);
-    ///
-    void SetLTNewPage(int cell, bool what);
-    ///
-    bool LTNewPage(int cell);
-private:
-    ///
-    struct cellstruct {
-       ///
-        cellstruct();
-       ///
-       ~cellstruct();
-       ///
-        cellstruct & operator=(cellstruct const &);
-       ///
-       int cellno;
-       ///
-       int width_of_cell;
-       ///
-       int  multicolumn; // add approp. signedness
-       ///
-       int alignment; // add approp. signedness
-       ///
-       bool top_line;
-       ///
-       bool bottom_line;
-       ///
-       bool has_cont_row;
-       ///
-       bool linebreaks;
-       ///
-       int rotate;
-       ///
-       string align_special;
-       ///
-       string p_width; // this is only set for multicolumn!!!
-    };
-    ///
-    struct rowstruct {
-       ///
-        rowstruct();
-       ///
-       ~rowstruct();
-       ///
-        rowstruct & operator=(rowstruct const &);
-       ///
-       bool top_line;
-       ///
-       bool bottom_line;
-       ///
-       bool is_cont_row;
-       ///
-        int ascent_of_row;
-       ///
-        int descent_of_row;
-       /// This are for longtables only
-       bool newpage;
-    };
-    ///
-    struct columnstruct {
-       ///
-        columnstruct();
-       ///
-       ~columnstruct();
-       ///
-        columnstruct & operator=(columnstruct const &);
-       ///
-       int alignment; // add approp. signedness
-       ///
-       bool left_line;
-       ///
-       bool right_line;
-       ///
-       int  width_of_column;
-       ///
-       string p_width;
-       ///
-       string align_special;
-    };
-    ///
-    int numberofcells;
-    ///
-    int * rowofcell;
-    ///
-    int * columnofcell;
-    ///
-    rowstruct * row_info;
-    ///
-    columnstruct * column_info;
-    ///
-    cellstruct ** cell_info;
-    ///
-    int width_of_table;
-    //
-    // for long tables
-    /// row of endhead
-    int endhead;
-    /// row of endfirst head
-    int endfirsthead;
-    /// row of endfoot
-    int endfoot;
-    /// row of endlastfoot
-    int endlastfoot;
-    ///
-    void set_row_column_number_info();
-    /// Returns true if a complete update is necessary, otherwise false
-    bool SetWidthOfMulticolCell(int cell, int new_width);
-    ///
-    void recalculateMulticolCells(int cell, int new_width);
-    /// Returns true if change
-    bool calculate_width_of_column(int column);
-    ///
-    bool calculate_width_of_column_NMC(int column); // no multi cells
-    ///
-    void calculate_width_of_table();
-
-    ///
-    int right_column_of_cell(int cell);
-
-    ///
-    cellstruct * cellinfo_of_cell(int cell);
-
-    ///
-    void delete_column(int column);
-
-    ///
-    int cells_in_multicolumn(int cell);
-    ///
-    int is_long_table;
-    ///
-    int rotate;
-};
-
-#endif