]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
more cursor dispatch
[lyx.git] / src / tabular.C
index 82fb4afb8ba5c4abde9b09204eff028a90aba816..3f43ff0de86612db84a9600964b7880e89354c26 100644 (file)
@@ -23,8 +23,8 @@
 #include "bufferparams.h"
 #include "debug.h"
 #include "LaTeXFeatures.h"
-#include "latexrunparams.h"
 #include "lyxlex.h"
+#include "outputparams.h"
 #include "paragraph.h"
 
 #include "insets/insettabular.h"
@@ -241,9 +241,7 @@ bool getTokenValue(string const & str, const char * token, int & num)
 bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
 {
        string tmp;
-       if (!getTokenValue(str, token, tmp))
-               return false;
-       return string2type(tmp, num);
+       return getTokenValue(str, token, tmp) && string2type(tmp, num);
 }
 
 
@@ -251,9 +249,7 @@ bool getTokenValue(string const & str, const char * token,
                                   LyXTabular::VAlignment & num)
 {
        string tmp;
-       if (!getTokenValue(str, token, tmp))
-               return false;
-       return string2type(tmp, num);
+       return getTokenValue(str, token, tmp) && string2type(tmp, num);
 }
 
 
@@ -261,9 +257,7 @@ bool getTokenValue(string const & str, const char * token,
                                   LyXTabular::BoxType & num)
 {
        string tmp;
-       if (!getTokenValue(str, token, tmp))
-               return false;
-       return string2type(tmp, num);
+       return getTokenValue(str, token, tmp) && string2type(tmp, num);
 }
 
 
@@ -273,9 +267,7 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
        // not in the file-format.
        flag = false;
        string tmp;
-       if (!getTokenValue(str, token, tmp))
-               return false;
-       return string2type(tmp, flag);
+       return getTokenValue(str, token, tmp) && string2type(tmp, flag);
 }
 
 
@@ -285,9 +277,7 @@ bool getTokenValue(string const & str, const char * token, LyXLength & len)
        // in the file format.
        len = LyXLength();
        string tmp;
-       if (!getTokenValue(str, token, tmp))
-               return false;
-       return isValidLength(tmp, &len);
+       return getTokenValue(str, token, tmp) && isValidLength(tmp, &len);
 }
 
 
@@ -1397,7 +1387,7 @@ void LyXTabular::setMultiColumn(Buffer * buffer, int cell, int number)
        for (int i = 1; i < number; ++i) {
                cellstruct & cs1 = cellinfo_of_cell(cell + i);
                cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
-               cs.inset.appendParagraphs(buffer, cs1.inset.paragraphs);
+               cs.inset.appendParagraphs(buffer, cs1.inset.paragraphs());
                cs1.inset.clear(false);
        }
        set_row_column_number_info();
@@ -1905,7 +1895,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
 
 
 int LyXTabular::TeXLongtableHeaderFooter(ostream & os, Buffer const & buf,
-                                        LatexRunParams const & runparams) const
+                                        OutputParams const & runparams) const
 {
        if (!is_long_tabular)
                return 0;
@@ -2005,7 +1995,7 @@ bool LyXTabular::isValidRow(int row) const
 
 
 int LyXTabular::TeXRow(ostream & os, int i, Buffer const & buf,
-                      LatexRunParams const & runparams) const
+                      OutputParams const & runparams) const
 {
        int ret = 0;
        int cell = getCellNumber(i, 0);
@@ -2018,8 +2008,8 @@ int LyXTabular::TeXRow(ostream & os, int i, Buffer const & buf,
                ret += TeXCellPreamble(os, cell);
                InsetText & inset = getCellInset(cell);
 
-               bool rtl = inset.paragraphs.begin()->isRightToLeftPar(bufferparams) &&
-                       !inset.paragraphs.begin()->empty() && getPWidth(cell).zero();
+               bool rtl = inset.paragraphs().begin()->isRightToLeftPar(bufferparams) &&
+                       !inset.paragraphs().begin()->empty() && getPWidth(cell).zero();
 
                if (rtl)
                        os << "\\R{";
@@ -2042,7 +2032,7 @@ int LyXTabular::TeXRow(ostream & os, int i, Buffer const & buf,
 
 
 int LyXTabular::latex(Buffer const & buf, ostream & os,
-                     LatexRunParams const & runparams) const
+                     OutputParams const & runparams) const
 {
        int ret = 0;
 
@@ -2150,7 +2140,7 @@ int LyXTabular::latex(Buffer const & buf, ostream & os,
 
 
 int LyXTabular::linuxdoc(Buffer const & buf, ostream & os,
-                        const LatexRunParams & runparams) const
+                        const OutputParams & runparams) const
 {
        os << "<tabular ca=\"";
        for (int i = 0; i < columns_; ++i) {
@@ -2192,7 +2182,7 @@ int LyXTabular::linuxdoc(Buffer const & buf, ostream & os,
 
 
 int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
-                          LatexRunParams const & runparams) const
+                          OutputParams const & runparams) const
 {
        int ret = 0;
        int cell = getFirstCellInRow(row);
@@ -2234,7 +2224,7 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
                }
 
                os << '>';
-               LatexRunParams runp = runparams;
+               OutputParams runp = runparams;
                runp.mixed_content = true;
                ret += getCellInset(cell).docbook(buf, os, runp);
                os << "</entry>\n";
@@ -2246,7 +2236,7 @@ int LyXTabular::docbookRow(Buffer const & buf, ostream & os, int row,
 
 
 int LyXTabular::docbook(Buffer const & buf, ostream & os,
-                       LatexRunParams const & runparams) const
+                       OutputParams const & runparams) const
 {
        int ret = 0;
 
@@ -2422,13 +2412,13 @@ int LyXTabular::asciiBottomHLine(ostream & os, int row,
 
 
 int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
-                              LatexRunParams const & runparams,
+                              OutputParams const & runparams,
                               int cell, int row, int column,
                               vector<unsigned int> const & clen,
                               bool onlydata) const
 {
        ostringstream sstr;
-       int ret = getCellInset(cell).ascii(buf, sstr, runparams);
+       int ret = getCellInset(cell).plaintext(buf, sstr, runparams);
 
        if (onlydata) {
                os << sstr.str();
@@ -2472,8 +2462,8 @@ int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
 }
 
 
-int LyXTabular::ascii(Buffer const & buf, ostream & os,
-                     LatexRunParams const & runparams,
+int LyXTabular::plaintext(Buffer const & buf, ostream & os,
+                     OutputParams const & runparams,
                      int const depth,
                      bool onlydata, unsigned char delim) const
 {
@@ -2491,7 +2481,7 @@ int LyXTabular::ascii(Buffer const & buf, ostream & os,
                                if (isMultiColumnReal(cell))
                                        continue;
                                ostringstream sstr;
-                               getCellInset(cell).ascii(buf, sstr, runparams);
+                               getCellInset(cell).plaintext(buf, sstr, runparams);
                                if (clen[j] < sstr.str().length())
                                        clen[j] = sstr.str().length();
                        }
@@ -2503,7 +2493,7 @@ int LyXTabular::ascii(Buffer const & buf, ostream & os,
                                if (!isMultiColumnReal(cell) || isPartOfMultiColumn(i, j))
                                        continue;
                                ostringstream sstr;
-                               getCellInset(cell).ascii(buf, sstr, runparams);
+                               getCellInset(cell).plaintext(buf, sstr, runparams);
                                int len = int(sstr.str().length());
                                int const n = cells_in_multicolumn(cell);
                                for (int k = j; len > 0 && k < j + n - 1; ++k)
@@ -2552,7 +2542,7 @@ InsetText & LyXTabular::getCellInset(int row, int column) const
 }
 
 
-int LyXTabular::getCellFromInset(InsetOld const * inset) const
+int LyXTabular::getCellFromInset(InsetBase const * inset) const
 {
        // is this inset part of the tabular?
        if (!inset) {
@@ -2601,7 +2591,7 @@ void LyXTabular::getLabelList(Buffer const & buffer,
 
 LyXTabular::BoxType LyXTabular::useParbox(int cell) const
 {
-       ParagraphList const & parlist = getCellInset(cell).paragraphs;
+       ParagraphList const & parlist = getCellInset(cell).paragraphs();
        ParagraphList::const_iterator cit = parlist.begin();
        ParagraphList::const_iterator end = parlist.end();