From e7f4618bcce770369cf46335c2c7f0164b4b8857 Mon Sep 17 00:00:00 2001 From: Michael Schmitt Date: Sun, 18 Feb 2007 18:50:08 +0000 Subject: [PATCH] * src/tabular.[Ch]: simplify plaintext methods, because there 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 | 38 ++++++++++++++++---------------------- src/tabular.h | 27 +++++++++++++-------------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/tabular.C b/src/tabular.C index 7d873348ee..39822ef7d8 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -2453,8 +2453,8 @@ int LyXTabular::docbook(Buffer const & buf, odocstream & os, } -int LyXTabular::plaintextTopHLine(odocstream & os, row_type row, - vector const & clen) const +bool LyXTabular::plaintextTopHLine(odocstream & os, row_type row, + vector 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 const & clen) const +bool LyXTabular::plaintextBottomHLine(odocstream & os, row_type row, + vector 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 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 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; } diff --git a/src/tabular.h b/src/tabular.h index 163f33a2b7..b972d0aa3c 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -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 const &) const; + bool plaintextTopHLine(odocstream &, row_type row, + std::vector const &) const; /// - int plaintextBottomHLine(odocstream &, row_type row, - std::vector const &) const; + bool plaintextBottomHLine(odocstream &, row_type row, + std::vector const &) const; /// - int plaintextPrintCell(Buffer const &, odocstream &, - OutputParams const &, - idx_type cell, row_type row, col_type column, - std::vector const &, - bool onlydata) const; + void plaintextPrintCell(Buffer const &, odocstream &, + OutputParams const &, + idx_type cell, row_type row, col_type column, + std::vector const &, + bool onlydata) const; /// auxiliary function for docbook int docbookRow(Buffer const & buf, odocstream & os, row_type, OutputParams const &) const; -- 2.39.2