]> git.lyx.org Git - features.git/commitdiff
* src/tabular.[Ch]: simplify plaintext methods, because there
authorMichael Schmitt <michael.schmitt@teststep.org>
Sun, 18 Feb 2007 18:50:08 +0000 (18:50 +0000)
committerMichael Schmitt <michael.schmitt@teststep.org>
Sun, 18 Feb 2007 18:50:08 +0000 (18:50 +0000)
is no longer a need to count the number of lines

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17243 a592a061-630c-0410-9148-cb99ea01b6c8

src/tabular.C
src/tabular.h

index 7d873348eefb5c772c9208d912815d838b02251c..39822ef7d89b18ab2460bf82d7415c0a6702e874 100644 (file)
@@ -2453,8 +2453,8 @@ int LyXTabular::docbook(Buffer const & buf, odocstream & os,
 }
 
 
-int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
-                             vector<unsigned int> const & clen) const
+bool LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
+                                   vector<unsigned int> const & clen) const
 {
        idx_type const fcell = getFirstCellInRow(row);
        idx_type const n = numberOfCellsInRow(fcell) + fcell;
@@ -2467,7 +2467,7 @@ int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
                }
        }
        if (!tmp)
-               return 0;
+               return false;
 
        char_type ch;
        for (idx_type i = fcell; i < n; ++i) {
@@ -2497,12 +2497,12 @@ int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
                }
        }
        os << endl;
-       return 1;
+       return true;
 }
 
 
-int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
-                                vector<unsigned int> const & clen) const
+bool LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
+                                      vector<unsigned int> const & clen) const
 {
        idx_type const fcell = getFirstCellInRow(row);
        idx_type const n = numberOfCellsInRow(fcell) + fcell;
@@ -2515,7 +2515,7 @@ int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
                }
        }
        if (!tmp)
-               return 0;
+               return false;
 
        char_type ch;
        for (idx_type i = fcell; i < n; ++i) {
@@ -2545,22 +2545,22 @@ int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
                }
        }
        os << endl;
-       return 1;
+       return true;
 }
 
 
-int LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
+void LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
                               OutputParams const & runparams,
                               idx_type cell, row_type row, col_type column,
                               vector<unsigned int> const & clen,
                               bool onlydata) const
 {
        odocstringstream sstr;
-       int const ret = getCellInset(cell)->plaintext(buf, sstr, runparams);
+       getCellInset(cell)->plaintext(buf, sstr, runparams);
 
        if (onlydata) {
                os << sstr.str();
-               return ret;
+               return;
        }
 
        if (leftLine(cell))
@@ -2597,18 +2597,13 @@ int LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
                os << " |";
        else
                os << "  ";
-
-       return ret;
 }
 
 
-int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
-                     OutputParams const & runparams,
-                     int const depth,
-                     bool onlydata, unsigned char delim) const
+void LyXTabular::plaintext(Buffer const & buf, odocstream & os,
+                           OutputParams const & runparams, int const depth,
+                           bool onlydata, unsigned char delim) const
 {
-       int ret = 0;
-
        // first calculate the width of the single columns
        vector<unsigned int> clen(columns_);
 
@@ -2652,8 +2647,8 @@ int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
                                continue;
                        if (onlydata && j > 0)
                                os << delim;
-                       ret += plaintextPrintCell(buf, os, runparams,
-                                             cell, i, j, clen, onlydata);
+                       plaintextPrintCell(buf, os, runparams,
+                                          cell, i, j, clen, onlydata);
                        ++cell;
                }
                os << endl;
@@ -2663,7 +2658,6 @@ int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
                                os << docstring(depth * 2, ' ');
                }
        }
-       return ret;
 }
 
 
index 163f33a2b746aa364181e4bd20f9b6f967078b52..b972d0aa3c7bc4b5330790c1e45e74048625bd95 100644 (file)
@@ -317,10 +317,9 @@ public:
        //
        int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
        ///
-       int plaintext(Buffer const &, odocstream &,
-                 OutputParams const & runparams,
-                 int const depth,
-                 bool onlydata, unsigned char delim) const;
+       void plaintext(Buffer const &, odocstream &,
+                      OutputParams const & runparams, int const depth,
+                      bool onlydata, unsigned char delim) const;
        ///
        bool isMultiColumn(idx_type cell) const;
        ///
@@ -604,19 +603,19 @@ public:
        int TeXRow(odocstream &, row_type const row, Buffer const & buf,
                   OutputParams const &) const;
        ///
-       // helper functions for plain text return number of newlines
+       // helper functions for plain text
        ///
-       int plaintextTopHLine(odocstream &, row_type row,
-                       std::vector<unsigned int> const &) const;
+       bool plaintextTopHLine(odocstream &, row_type row,
+                              std::vector<unsigned int> const &) const;
        ///
-       int plaintextBottomHLine(odocstream &, row_type row,
-                       std::vector<unsigned int> const &) const;
+       bool plaintextBottomHLine(odocstream &, row_type row,
+                                 std::vector<unsigned int> const &) const;
        ///
-       int plaintextPrintCell(Buffer const &, odocstream &,
-                       OutputParams const &,
-                       idx_type cell, row_type row, col_type column,
-                       std::vector<unsigned int> const &,
-                                          bool onlydata) const;
+       void plaintextPrintCell(Buffer const &, odocstream &,
+                               OutputParams const &,
+                               idx_type cell, row_type row, col_type column,
+                               std::vector<unsigned int> const &,
+                               bool onlydata) const;
        /// auxiliary function for docbook
        int docbookRow(Buffer const & buf, odocstream & os, row_type,
                       OutputParams const &) const;