From: Jürgen Vigna Date: Tue, 26 Sep 2000 15:25:14 +0000 (+0000) Subject: Added linelen to insets-ascii-function, some fixes and new support X-Git-Tag: 1.6.10~21972 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=99d6f056e4e1c7514696ca29cf567d6cbb300aee;p=features.git Added linelen to insets-ascii-function, some fixes and new support functions. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1042 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index faf0a38f2f..7377cb66f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2000-09-26 Juergen Vigna + + * src/buffer.C (asciiParagraph): new function. + (writeFileAscii): new function with parameter ostream. + (writeFileAscii): use now asciiParagraph. + + * various inset files: added the linelen parameter to the Ascii-func. + + * src/tabular.C (Write): fixed error in writing file introduced by + the last changes from Lars. + + * lib/bind/menus.bind: removed not supported functions. + + * src/insets/insettext.C (Ascii): implemented this function. + + * src/insets/lyxinset.h (Ascii): added linelen parameter. + + * src/tabular.C (write_attribute[int,string,bool]): new functions. + (Write): use of the write_attribute functions. + + * src/bufferlist.C (close): fixed reasking question! + 2000-09-26 Lars Gullik Bjønnes * src/support/unlink.C src/support/remove.C src/support/mkdir.C: diff --git a/lib/bind/menus.bind b/lib/bind/menus.bind index 07d7a1c390..dec163a9ee 100644 --- a/lib/bind/menus.bind +++ b/lib/bind/menus.bind @@ -96,9 +96,6 @@ \bind "M-l c" "layout-character" \bind "M-l p" "layout-paragraph" \bind "M-l d" "layout-document" -\bind "M-l a" "layout-paper" -\bind "M-l e" "layout-table" -\bind "M-l q" "layout-quotes" \bind "M-l m" "font-emph" \bind "M-l n" "font-noun" \bind "M-l b" "font-bold" @@ -107,7 +104,6 @@ \bind "M-l l" "layout-preamble" \bind "M-l s" "layout-save-default" \bind "M-l space" "menu-open Layout" -\bind "M-l i" "buffer-itemize-bullets-select" \bind "M-l x" "appendix" # diff --git a/src/buffer.C b/src/buffer.C index 7f3372b60b..6d8b78a846 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -92,6 +92,7 @@ #include "frontends/Dialogs.h" #include "encoding.h" #include "exporter.h" +#include "Lsstream.h" using std::ostream; using std::ofstream; @@ -1288,6 +1289,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const } +#if 0 void Buffer::writeFileAscii(string const & fname, int linelen) { Inset * inset; @@ -1503,7 +1505,243 @@ void Buffer::writeFileAscii(string const & fname, int linelen) ofs << "\n"; } +//---------------------------------------------------------------------------- +#else +//---------------------------------------------------------------------------- +string const Buffer::asciiParagraph(LyXParagraph const * par, int linelen) const +{ + ostringstream buffer; + LyXFont font1, font2; + Inset const * inset; + char c, footnoteflag = 0, depth = 0; + string tmp; + LyXParagraph::size_type i; + int j; + int ltype = 0; + int ltype_depth = 0; + int actcell = 0; + int currlinelen = 0; + bool ref_printed = false; + string fname1 = TmpFileName(); + + int noparbreak = 0; + int islatex = 0; + if ( +#ifndef NEW_INSETS + par->footnoteflag != LyXParagraph::NO_FOOTNOTE || +#endif + !par->previous +#ifndef NEW_INSETS + || par->previous->footnoteflag == LyXParagraph::NO_FOOTNOTE +#endif + ){ +#ifndef NEW_INSETS + /* begins a footnote environment ? */ + if (footnoteflag != par->footnoteflag) { + footnoteflag = par->footnoteflag; + if (footnoteflag) { + j = strlen(string_footnotekinds[par->footnotekind])+4; + if ((linelen > 0) && + ((currlinelen + j) > linelen)) { + buffer << "\n"; + currlinelen = 0; + } + buffer << + "([" << + string_footnotekinds[par->footnotekind] << + "] "; + currlinelen += j; + } + } +#endif + /* begins or ends a deeper area ?*/ + if (depth != par->depth) { + if (par->depth > depth) { + while (par->depth > depth) { + ++depth; + } + } + else { + while (par->depth < depth) { + --depth; + } + } + } + + /* First write the layout */ + tmp = textclasslist.NameOfLayout(params.textclass, par->layout); + if (tmp == "Itemize") { + ltype = 1; + ltype_depth = depth+1; + } else if (tmp == "Enumerate") { + ltype = 2; + ltype_depth = depth+1; + } else if (strstr(tmp.c_str(), "ection")) { + ltype = 3; + ltype_depth = depth+1; + } else if (strstr(tmp.c_str(), "aragraph")) { + ltype = 4; + ltype_depth = depth+1; + } else if (tmp == "Description") { + ltype = 5; + ltype_depth = depth+1; + } else if (tmp == "Abstract") { + ltype = 6; + ltype_depth = 0; + } else if (tmp == "Bibliography") { + ltype = 7; + ltype_depth = 0; + } else { + ltype = 0; + ltype_depth = 0; + } + + /* maybe some vertical spaces */ + + /* the labelwidthstring used in lists */ + + /* some lines? */ + + /* some pagebreaks? */ + + /* noindent ? */ + + /* what about the alignment */ + } else { +#ifndef NEW_INSETS + /* dummy layout, that means a footnote ended */ + footnoteflag = LyXParagraph::NO_FOOTNOTE; + buffer << ") "; + noparbreak = 1; +#else + lyxerr << "Should this ever happen?" << endl; +#endif + } + + font1 = LyXFont(LyXFont::ALL_INHERIT, params.language_info); + actcell = 0; + for (i = 0; i < par->size(); ++i) { + if (!i && !footnoteflag && !noparbreak){ + buffer << "\n\n"; + for(j = 0; j < depth; ++j) + buffer << " "; + currlinelen = depth * 2; + switch(ltype) { + case 0: /* Standard */ + case 4: /* (Sub)Paragraph */ + case 5: /* Description */ + break; + case 6: /* Abstract */ + buffer << "Abstract\n\n"; + break; + case 7: /* Bibliography */ + if (!ref_printed) { + buffer << "References\n\n"; + ref_printed = true; + } + break; + default: + buffer << par->labelstring << " "; + break; + } + if (ltype_depth > depth) { + for(j = ltype_depth - 1; j > depth; --j) + buffer << " "; + currlinelen += (ltype_depth-depth)*2; + } + } + font2 = par->GetFontSettings(params, i); + if (font1.latex() != font2.latex()) { + if (font2.latex() == LyXFont::OFF) + islatex = 0; + else + islatex = 1; + } else { + islatex = 0; + } + c = par->GetChar(i); + if (islatex) + continue; + switch (c) { + case LyXParagraph::META_INSET: + if ((inset = par->GetInset(i))) { + if (!inset->Ascii(this, buffer)) { + string dummy; + string s = rsplit(buffer.str(), + dummy, '\n'); + currlinelen += s.length(); + } else { + // to be sure it breaks paragraph + currlinelen += linelen; + } + } + break; + case LyXParagraph::META_NEWLINE: + buffer << "\n"; + for(j = 0; j < depth; ++j) + buffer << " "; + currlinelen = depth * 2; + if (ltype_depth > depth) { + for(j = ltype_depth; + j > depth; --j) + buffer << " "; + currlinelen += (ltype_depth - depth) * 2; + } + break; + case LyXParagraph::META_HFILL: + buffer << "\t"; + break; + case '\\': + buffer << "\\"; + break; + default: + if ((linelen > 0) && (currlinelen > (linelen - 10)) && + (c == ' ') && ((i + 2) < par->size())) + { + buffer << "\n"; + for(j = 0; j < depth; ++j) + buffer << " "; + currlinelen = depth * 2; + if (ltype_depth > depth) { + for(j = ltype_depth; + j > depth; --j) + buffer << " "; + currlinelen += (ltype_depth-depth)*2; + } + } else if (c != '\0') + buffer << c; + else if (c == '\0') + lyxerr.debug() << "writeAsciiFile: NULL char in structure." << endl; + ++currlinelen; + break; + } + } + return buffer.str(); +} + + +void Buffer::writeFileAscii(string const & fname, int linelen) +{ + ofstream ofs(fname.c_str()); + if (!ofs) { + WriteFSAlert(_("Error: Cannot write file:"), fname); + return; + } + writeFileAscii(ofs, linelen); +} + + +void Buffer::writeFileAscii(ostream & ofs, int linelen) +{ + LyXParagraph * par = paragraph; + while (par) { + ofs << asciiParagraph(par, linelen); + par = par->next; + } + ofs << "\n"; +} +#endif void Buffer::makeLaTeXFile(string const & fname, string const & original_path, diff --git a/src/buffer.h b/src/buffer.h index 39e5a51dfc..53df1feade 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -150,7 +150,8 @@ public: /// void writeFileAscii(string const & , int); - + void writeFileAscii(std::ostream &, int); + string const asciiParagraph(LyXParagraph const *, int linelen) const; /// void makeLaTeXFile(string const & filename, string const & original_path, diff --git a/src/bufferlist.C b/src/bufferlist.C index 0d4d660250..677e92a3f0 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -192,6 +192,7 @@ bool BufferList::close(Buffer * buf) reask = !MenuWriteAs(buf); else if (buf->save()) { lastfiles->newFile(buf->fileName()); + reask = false; } else { if (buf->getUser()) AllowInput(buf->getUser()); diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 35b4a6a63a..4b71d58a55 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -1155,7 +1155,7 @@ int InsetFig::Latex(Buffer const *, ostream & os, } -int InsetFig::Ascii(Buffer const *, ostream &) const +int InsetFig::Ascii(Buffer const *, ostream &, int) const { return 0; } diff --git a/src/insets/figinset.h b/src/insets/figinset.h index 8c0799cca0..58afd4ebe6 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -38,7 +38,7 @@ public: /// int Latex(Buffer const *, std::ostream &, bool fragile, bool free_space) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index e01b0cbc19..52b317f5ca 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -94,7 +94,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const { return 0; } + int Ascii(Buffer const *, std::ostream &, int) const { return 0; } /// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } /// diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 0530cc516e..e7ad117674 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -199,7 +199,7 @@ int InsetCommand::Latex(Buffer const *, ostream & os, } -int InsetCommand::Ascii(Buffer const *, ostream &) const +int InsetCommand::Ascii(Buffer const *, ostream &, int) const { return 0; } diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 469b65bc53..8575639032 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -97,7 +97,7 @@ public: virtual int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// virtual int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index 47a67a9bc2..d2b79d33cb 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -51,7 +51,7 @@ public: /// int Latex(Buffer const *, std::ostream &, bool, bool) const { return 0; } /// - int Ascii(Buffer const *, std::ostream &) const { return 0; } + int Ascii(Buffer const *, std::ostream &, int) const { return 0; } /// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 7af977b034..cd42207704 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -356,7 +356,7 @@ int InsetExternal::Latex(Buffer const * buf, } -int InsetExternal::Ascii(Buffer const * buf, std::ostream & os) const +int InsetExternal::Ascii(Buffer const * buf, std::ostream & os, int) const { return write("Ascii", buf, os); } diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index 2c02c285d1..6162638a5e 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -47,7 +47,7 @@ public: virtual int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - virtual int Ascii(Buffer const *, std::ostream &) const; + virtual int Ascii(Buffer const *, std::ostream &, int linelen) const; /// virtual int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 7449f34f3f..4435b3f461 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -592,7 +592,7 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os, } -int InsetGraphics::Ascii(Buffer const *, ostream &) const +int InsetGraphics::Ascii(Buffer const *, ostream &, int) const { // No graphics in ascii output. return 0; diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index ec1c1bae11..72e9cafef0 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -71,7 +71,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 55d6cf9111..ae77a9b5ce 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -144,7 +144,7 @@ int InsetInfo::Latex(Buffer const *, ostream &, } -int InsetInfo::Ascii(Buffer const *, ostream &) const +int InsetInfo::Ascii(Buffer const *, ostream &, int) const { return 0; } diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index 9e9b342e58..08f1ebc95a 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -53,7 +53,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index dbb8106205..a6a5b0a324 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -629,7 +629,7 @@ int InsetLatexAccent::Latex(Buffer const *, ostream & os, } -int InsetLatexAccent::Ascii(Buffer const *, ostream & os) const +int InsetLatexAccent::Ascii(Buffer const *, ostream & os, int) const { os << contents; return 0; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index c61bfec1c6..e583ab57ce 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -57,7 +57,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index b03780babe..8444ee0aa9 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -259,7 +259,7 @@ int InsetQuotes::Latex(Buffer const *, ostream & os, } -int InsetQuotes::Ascii(Buffer const *, ostream & os) const +int InsetQuotes::Ascii(Buffer const *, ostream & os, int) const { os << "\""; return 0; diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index eb4ce51012..978891bc48 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -89,7 +89,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index 48fa451654..ca1b9cb4de 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -196,7 +196,7 @@ int InsetSpecialChar::Latex(Buffer const *, ostream & os, bool /*fragile*/, return 0; } -int InsetSpecialChar::Ascii(Buffer const *, ostream & os) const +int InsetSpecialChar::Ascii(Buffer const *, ostream & os, int) const { switch (kind) { case HYPHENATION: break; @@ -211,13 +211,13 @@ int InsetSpecialChar::Ascii(Buffer const *, ostream & os) const int InsetSpecialChar::Linuxdoc(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } int InsetSpecialChar::DocBook(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 8a2bbf90e5..928892878b 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -59,7 +59,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 59fb7c7732..ada68fc0ad 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -896,7 +896,7 @@ int InsetTabular::Latex(Buffer const * buf, ostream & os, } -int InsetTabular::Ascii(Buffer const * buf, ostream & os) const +int InsetTabular::Ascii(Buffer const * buf, ostream & os, int) const { // This should be changed to a real ascii export return tabular->Latex(buf, os, false, false); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 64191fa33b..df4d05a0c1 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -135,7 +135,7 @@ public: /// int Latex(Buffer const *, std::ostream &, bool, bool) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index d75373a076..3b224b9b49 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -108,7 +108,8 @@ void InsetText::init(InsetText const * ins) InsetText::~InsetText() { for(Cache::const_iterator cit=cache.begin(); cit != cache.end(); ++cit) - deleteLyXText((*cit).first); + delete (*cit).second; +// deleteLyXText((*cit).first); LyXParagraph * p = par->next; delete par; while(p) { @@ -1022,6 +1023,17 @@ int InsetText::Latex(Buffer const * buf, ostream & os, bool, bool) const } +int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const +{ + LyXParagraph * p = par; + while (p) { + os << buf->asciiParagraph(p, linelen); + p = p->next; + } + os << "\n"; +} + + void InsetText::Validate(LaTeXFeatures & features) const { LyXParagraph * p = par; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index eb92980d4c..24c72ca054 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -126,7 +126,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const { return 0; } + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index a894d97511..14831464cb 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -171,7 +171,7 @@ public: virtual int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const = 0; /// - virtual int Ascii(Buffer const *, std::ostream &) const = 0; + virtual int Ascii(Buffer const *, std::ostream &, int linelen=0) const = 0; /// virtual int Linuxdoc(Buffer const *, std::ostream &) const = 0; /// diff --git a/src/mathed/formula.C b/src/mathed/formula.C index e4a457621d..7cae85ba81 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -331,7 +331,7 @@ int InsetFormula::Latex(Buffer const *, ostream & os, bool fragile, bool) const } -int InsetFormula::Ascii(Buffer const *, ostream & os) const +int InsetFormula::Ascii(Buffer const *, ostream & os, int) const { par->Write(os, false); return 0; @@ -340,13 +340,13 @@ int InsetFormula::Ascii(Buffer const *, ostream & os) const int InsetFormula::Linuxdoc(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } int InsetFormula::DocBook(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } diff --git a/src/mathed/formula.h b/src/mathed/formula.h index 926a029f70..dbee7144b7 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -56,7 +56,7 @@ public: int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; /// - int Ascii(Buffer const *, std::ostream &) const; + int Ascii(Buffer const *, std::ostream &, int linelen) const; /// int Linuxdoc(Buffer const *, std::ostream &) const; /// diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 638ef72d1d..d74a5b3bff 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -83,13 +83,13 @@ int InsetFormulaMacro::Latex(Buffer const *, ostream & os, bool /*fragile*/, int InsetFormulaMacro::Linuxdoc(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } int InsetFormulaMacro::DocBook(Buffer const * buf, ostream & os) const { - return Ascii(buf, os); + return Ascii(buf, os, 0); } diff --git a/src/tabular.C b/src/tabular.C index 275cfb132b..2f4abff801 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -918,51 +918,81 @@ int LyXTabular::right_column_of_cell(int cell) const } +const string write_attribute(const string name, const int value) +{ + string str = " " + name + "=\"" + tostr(value) + "\""; + return str; +} + + +const string write_attribute(string name, const string & value) +{ + string str = " " + name + "=\"" + value + "\""; + return str; +} + + +const string write_attribute(string name, const bool value) +{ + string str = " " + name + "=\"" + tostr((int)value) + "\""; + return str; +} + + void LyXTabular::Write(Buffer const * buf, ostream & os) const { // header line - os << "\n"; + os << "\n"; // global longtable options - os << "\n\n"; + os << "\n\n"; for (int i = 0; i < rows_; ++i) { - os << "\n"; + os << "\n"; for (int j = 0; j < columns_; ++j) { if (!i) { - os << ""; + os << "\n"; } else { os << "\n"; } - os << "\n"; + os << "\n"; os << "\\begin_inset "; cell_info[i][j].inset.Write(buf, os); os << "\n\\end_inset \n" << "\n" - << ""; + << "\n"; } os << "\n"; }