]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
2001-12-28 Lars Gullik Bj�nnes <larsbj@birdstep.com>
[lyx.git] / src / insets / insettabular.C
index 56ee3f2926420cf9adf258fdf981bcb6bb0c7e8b..6e68763d7d0ce0c7a157d146bf3ee0e8b008d6ff 100644 (file)
@@ -34,6 +34,7 @@
 #include "BufferView.h"
 #include "undo_funcs.h"
 #include "lyxlength.h"
+#include "ParagraphParameters.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/Alert.h"
@@ -1188,22 +1189,24 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
 
 
 int InsetTabular::latex(Buffer const * buf, ostream & os,
-                       bool fragile, bool fp) const
+                        bool fragile, bool fp) const
 {
-       return tabular->Latex(buf, os, fragile, fp);
+       return tabular->latex(buf, os, fragile, fp);
 }
 
 
-int InsetTabular::ascii(Buffer const * buf, ostream & os, int) const
+int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
 {
-       // This should be changed to a real ascii export
-       return tabular->Ascii(buf, os);
+       if (ll > 0)
+               return tabular->ascii(buf, os, (int)parOwner()->params().depth(),
+                                     false,0);
+       return tabular->ascii(buf, os, 0, false,0);
 }
 
 
 int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
 {
-       return tabular->Ascii(buf,os);
+       return tabular->ascii(buf,os, (int)parOwner()->params().depth(), false, 0);
 }
 
 
@@ -1222,7 +1225,7 @@ int InsetTabular::docbook(Buffer const * buf, ostream & os) const
                os << "<informaltable>\n";
                ret++;
        }
-       ret+= tabular->DocBook(buf,os);
+       ret+= tabular->docBook(buf,os);
        if (!master) {
                os << "</informaltable>\n";
                ret++;
@@ -1670,20 +1673,20 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
 }
 
 static void checkLongtableSpecial(LyXTabular::ltType & ltt,
-                                  string const & special,
-                                  int const row, bool const flag)
+                                  string const & special, bool & flag)
 {
        if (special == "dl_above") {
                ltt.topDL = flag;
+               ltt.set = false;
        } else if (special == "dl_below") {
                ltt.bottomDL = flag;
+               ltt.set = false;
        } else if (special == "empty") {
                ltt.empty = flag;
-       } else {
-               if (flag)
-                       ltt.row = row;
-               else
-                       ltt.row = 0;
+               ltt.set = false;
+       } else if (flag) {
+               ltt.empty = false;
+               ltt.set = true;
        }
 }
 
@@ -1994,29 +1997,29 @@ void InsetTabular::tabularFeatures(BufferView * bv,
                flag = false;
        case LyXTabular::SET_LTFIRSTHEAD:
                (void)tabular->GetRowOfLTFirstHead(row, ltt);
-               checkLongtableSpecial(ltt, value, row + 1, flag);
-               tabular->SetLTHead(ltt, true);
+               checkLongtableSpecial(ltt, value, flag);
+               tabular->SetLTHead(row, flag, ltt, true);
                break;
        case LyXTabular::UNSET_LTHEAD:
                flag = false;
        case LyXTabular::SET_LTHEAD:
                (void)tabular->GetRowOfLTHead(row, ltt);
-               checkLongtableSpecial(ltt, value, row + 1, flag);
-               tabular->SetLTHead(ltt, false);
+               checkLongtableSpecial(ltt, value, flag);
+               tabular->SetLTHead(row, flag, ltt, false);
                break;
        case LyXTabular::UNSET_LTFOOT:
                flag = false;
        case LyXTabular::SET_LTFOOT:
                (void)tabular->GetRowOfLTFoot(row, ltt);
-               checkLongtableSpecial(ltt, value, row + 1, flag);
-               tabular->SetLTFoot(ltt, false);
+               checkLongtableSpecial(ltt, value, flag);
+               tabular->SetLTFoot(row, flag, ltt, false);
                break;
        case LyXTabular::UNSET_LTLASTFOOT:
                flag = false;
        case LyXTabular::SET_LTLASTFOOT:
                (void)tabular->GetRowOfLTLastFoot(row, ltt);
-               checkLongtableSpecial(ltt, value, row + 1, flag);
-               tabular->SetLTFoot(ltt, true);
+               checkLongtableSpecial(ltt, value, flag);
+               tabular->SetLTFoot(row, flag, ltt, true);
                break;
        case LyXTabular::SET_LTNEWPAGE:
        {
@@ -2449,7 +2452,8 @@ bool InsetTabular::copySelection(BufferView * bv)
                                    true, true);
 
        ostringstream sstr;
-       paste_tabular->Ascii(bv->buffer(), sstr);
+       paste_tabular->ascii(bv->buffer(), sstr,
+                            (int)parOwner()->params().depth(), true, '\t');
        bv->stuffClipboard(sstr.str().c_str());
        return true;
 }