/* This file is part of
-* ======================================================
-*
-* LyX, The Document Processor
-*
-* Copyright (C) 1995 Matthias Ettrich
-* Copyright (C) 1995-1998 The LyX Team.
-*
-*======================================================*/
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
+ *
+ * ======================================================*/
#include <config.h>
#include "layout.h"
#include "tex-strings.h"
#include "bufferparams.h"
-#include "FileInfo.h"
-#include "error.h"
+#include "support/FileInfo.h"
+#include "debug.h"
#include "LaTeXFeatures.h"
#include "insets/insetinclude.h"
-#include "filetools.h"
+#include "support/filetools.h"
#include "lyx_gui_misc.h"
#include "texrow.h"
-// $Id: paragraph.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: paragraph.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
-#endif /* lint */
-
#define INITIAL_SIZE_PAR 10 /*Number of bytes in one paragraph*/
#define STEP_SIZE_PAR 10 /*Number of bytes added when reallocated*/
-extern void addNewlineAndDepth(LString & file, int const depth); // Jug 990923
+extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923
extern unsigned char GetCurrentTextClass(); // this should be fixed/removed
int tex_code_break_column = 72; // needs non-zero initialization. set later.
// this is a bad idea, but how can LyXParagraph find its buffer to get
// ale970405
-extern LString bibitemWidthest();
+extern string bibitemWidthest();
/* this is a minibuffer */
static char minibuffer_char;
appendix = false;
enumdepth = 0;
itemdepth = 0;
- next = NULL;
- previous = NULL;
- fonttable = NULL;
- insettable = NULL;
+ next = 0;
+ previous = 0;
+ fonttable = 0;
+ insettable = 0;
footnoteflag = LyXParagraph::NO_FOOTNOTE;
align = LYX_ALIGN_BLOCK;
/* table stuff -- begin*/
- table = NULL;
+ table = 0;
/* table stuff -- end*/
id = paragraph_id++;
- bibkey = NULL; // ale970302
+ bibkey = 0; // ale970302
Clear();
}
next->previous = this;
previous = par;
previous->next = this;
- fonttable = NULL;
- insettable = NULL;
+ fonttable = 0;
+ insettable = 0;
footnoteflag = LyXParagraph::NO_FOOTNOTE;
footnotekind = LyXParagraph::FOOTNOTE;
/* table stuff -- begin*/
- table = NULL;
+ table = 0;
/* table stuff -- end*/
id = paragraph_id++;
- bibkey = NULL; // ale970302
+ bibkey = 0; // ale970302
// ale970302
-// fprintf(stderr, "new bib "); fflush(stderr);
+// lyxerr << "new bib " << endl;
// if (par->bibkey) {
// bibkey = new InsetBibKey(par->bibkey);
// }
if( c == '\0')
return false;
// We want to pass the ' and escape chars to ispell
- LString extra = lyxrc->isp_esc_chars + '\'';
+ string extra = lyxrc->isp_esc_chars + '\'';
char ch[2];
ch[0] = c;
ch[1] = 0;
- return extra.contains(ch);
+ return contains(extra, ch);
}
if (c != '\0')
fprintf(file, "%c", c);
else
- lyxerr.print("ERROR (LyXParagraph::writeFile):"
- " NULL char in structure.");
+ lyxerr << "ERROR (LyXParagraph::writeFile):"
+ " NULL char in structure." << endl;
column++;
break;
}
FontTable *tmpfonttable = fonttable;
while (tmpfonttable) {
if (tmpfonttable->font.noun() == LyXFont::ON) {
- lyxerr.debug(LString("font.noun: ")
- + int(tmpfonttable->font.noun()),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "font.noun: "
+ << tmpfonttable->font.noun()
+ << endl;
features.noun = true;
- lyxerr.debug("Noun enabled. Font: "
- +tmpfonttable->font.stateText(),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "Noun enabled. Font: "
+ << tmpfonttable->font.stateText()
+ << endl;
}
switch (tmpfonttable->font.color()) {
case LyXFont::NONE:
break;
default:
features.color = true;
- lyxerr.debug("Color enabled. Font: "
- +tmpfonttable->font.stateText(),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "Color enabled. Font: "
+ << tmpfonttable->font.stateText()
+ << endl;
}
tmpfonttable = tmpfonttable->next;
}
if (GetInset(pos)) {
minibuffer_inset = GetInset(pos)->Clone();
} else {
- minibuffer_inset = NULL;
+ minibuffer_inset = 0;
minibuffer_char = ' ';
// This reflects what GetInset() does (ARRae)
}
tmpi=tmpi->next;
}
if (tmpi) { /* This should always be true */
- tmpi->inset = NULL;
+ tmpi->inset = 0;
}
} else {
- minibuffer_inset = NULL;
+ minibuffer_inset = 0;
minibuffer_char = ' ';
// This reflects what GetInset() does (ARRae)
}
noindent = false;
pextra_type = PEXTRA_NONE;
- pextra_width.clean();
- pextra_widthp.clean();
+ pextra_width.clear();
+ pextra_widthp.clear();
pextra_alignment = MINIPAGE_ALIGN_TOP;
pextra_hfill = false;
pextra_start_minipage = false;
- labelstring.clean();
- labelwidthstring.clean();
+ labelstring.clear();
+ labelwidthstring.clear();
layout = 0;
- bibkey = NULL;
+ bibkey = 0;
start_of_appendix = false;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->Erase(pos - last - 1);
else
- lyxerr.debug("ERROR (LyXParagraph::Erase): position does not exist.");
+ lyxerr.debug() << "ERROR (LyXParagraph::Erase): "
+ "position does not exist." << endl;
return;
}
if (pos < last) { // last is free for insertation, but should be empty
/* erase entries in the tables */
int found = 0;
FontTable *tmp = fonttable;
- FontTable *prev = NULL;
+ FontTable *prev = 0;
while (tmp && !found) {
if (pos >= tmp->pos && pos <= tmp->pos_end)
found = 1;
}
} else {
- lyxerr.print("ERROR (LyXParagraph::Erase): can't erase non-existant char.");
+ lyxerr << "ERROR (LyXParagraph::Erase): "
+ "can't erase non-existant char." << endl;
}
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->Enlarge(pos - last - 1, number);
else
- lyxerr.print("ERROR (LyXParagraph::Enlarge): position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::Enlarge): "
+ "position does not exist." << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->InsertChar(pos - last - 1, c);
else
- lyxerr.debug("ERROR (LyXParagraph::InsertChar): "
- "position does not exist.");
+ lyxerr.debug() << "ERROR (LyXParagraph::InsertChar): "
+ "position does not exist." << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->InsertInset(pos - last - 1, inset);
else
- lyxerr.print("ERROR (LyXParagraph::InsertInset): "
- "position does not exist: " + pos);
+ lyxerr << "ERROR (LyXParagraph::InsertInset): "
+ "position does not exist: " << pos << endl;
return;
}
if (text[pos]!=LYX_META_INSET) {
- lyxerr.print("ERROR (LyXParagraph::InsertInset): "
- "there is no LYX_META_INSET");
+ lyxerr << "ERROR (LyXParagraph::InsertInset): "
+ "there is no LYX_META_INSET" << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->GetInset(pos - last - 1);
else {
- lyxerr.print(LString("ERROR (LyXParagraph::GetInset): position does not exist: ") + pos);
+ lyxerr << "ERROR (LyXParagraph::GetInset): position does not exist: "
+ << pos << endl;
}
- return NULL;
+ return 0;
}
/* find the inset */
if (tmpi)
return tmpi->inset;
else {
- lyxerr.print(LString("ERROR (LyXParagraph::GetInset): "
- "Inset does not exist: ") + pos);
+ lyxerr << "ERROR (LyXParagraph::GetInset): "
+ "Inset does not exist: " << pos << endl;
text[pos] = ' '; /// WHY!!! does this set the pos to ' '????
// Did this commenting out introduce a bug? So far I have not
// seen any, please enlighten me. (Lgb)
// My guess is that since the inset does not exist, we might
// as well replace it with a space to prevent crashes. (Asger)
- return NULL;
+ return 0;
}
}
// enough for this to be anable on debug?
// We want strict error checking, but it's ok to only
// have it when debugging. (Asger)
- lyxerr.print(
- LString("ERROR (LyXParagraph::GetFontSettings): "
- "position does not exist. ") + pos);
+ lyxerr << "ERROR (LyXParagraph::GetFontSettings): "
+ "position does not exist. " << pos << endl;
}
} else if (pos) {
return GetFontSettings(pos - 1);
if (pos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
- lyxerr.print(LString("FATAL ERROR (LyXParagraph::GetChar):"
- " bad position ") + pos);
+ lyxerr << "FATAL ERROR (LyXParagraph::GetChar):"
+ " bad position " << pos << endl;
abort();
}
#endif
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
return NextAfterFootnote()->GetChar(pos - last - 1);
else
- lyxerr.print("ERROR (LyXParagraph::GetChar): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::GetChar): "
+ "position does not exist." << endl;
return '\0';
} else { // pos==last
/* we should have a footnote environment */
if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
// Notice that LyX does request the last char from time to time. (Asger)
-// lyxerr.print("ERROR (LyXParagraph::GetChar): "
-// "expected footnote.");
+// lyxerr << "ERROR (LyXParagraph::GetChar): "
+// "expected footnote." << endl;
return '\0';
}
switch (next->footnotekind) {
// return LYX_META_TAB;
// if (next->footnotekind == LyXParagraph::ALGORITHM)
// return LYX_META_ALGORITHM;
-// lyxerr.print("ERROR (LyXParagraph::GetChar): "
-// "unknown footnote kind.");
+// lyxerr << "ERROR (LyXParagraph::GetChar): "
+// "unknown footnote kind." << endl;
// return 'F'; /* this should not happen! */
// This _can_ not happen, due to the type of next->footnotekind
// being LyXParagraph::footnot_kind
}
-LString LyXParagraph::GetWord(int & lastpos)
+string LyXParagraph::GetWord(int & lastpos)
//Added 98/9/21 by REH
- // return an LString of the current word, and the end of the word
+ // return an string of the current word, and the end of the word
// in lastpos.
// the current word is defined as starting at the first character from
if (lastpos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
- lyxerr.print(LString("FATAL ERROR (LyXParagraph::GetWord):"
- " bad position ") + lastpos);
+ lyxerr << "FATAL ERROR (LyXParagraph::GetWord):"
+ " bad position " << lastpos << endl;
abort();
}
#endif
- LString theword;
+ string theword;
// grab a word
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->ParFromPos(pos - last - 1);
else
- lyxerr.print("ERROR (LyXParagraph::ParFromPos): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::ParFromPos): "
+ "position does not exist." << endl;
return this;
}
else
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->PositionInParFromPos(pos - last - 1);
else
- lyxerr.print(
+ lyxerr <<
"ERROR (LyXParagraph::PositionInParFromPos): "
- "position does not exist.");
+ "position does not exist." << endl;
return pos;
}
else
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
NextAfterFootnote()->SetFont(pos - last - 1, font);
} else {
- lyxerr.print("ERROR (LyXParagraph::SetFont): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::SetFont): "
+ "position does not exist." << endl;
}
return;
}
if (table)
result->table = table->Clone();
else
- result->table = NULL;
+ result->table = 0;
/* table stuff -- end*/
// ale970302
}
-LString LyXParagraph::GetLabelString()
+string LyXParagraph::GetLabestring()
{
return FirstPhysicalPar()->labelstring;
}
/* the next two functions are for the manual labels */
-LString LyXParagraph::GetLabelWidthString()
+string LyXParagraph::GetLabelWidthString()
{
if (!FirstPhysicalPar()->labelwidthstring.empty())
return FirstPhysicalPar()->labelwidthstring;
}
-void LyXParagraph::SetLabelWidthString(LString const & s)
+void LyXParagraph::SetLabelWidthString(string const & s)
{
LyXParagraph *par = FirstPhysicalPar();
{
LyXParagraph
*par = FirstPhysicalPar(),
- *ppar = NULL,
- *npar = NULL;
+ *ppar = 0,
+ *npar = 0;
par->layout = new_layout;
/* table stuff -- begin*/
npar = npar->Next()->NextAfterFootnote();
}
if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- LString
+ string
p1 = ppar->pextra_width,
p2 = ppar->pextra_widthp;
ppar->SetPExtraType(ppar->pextra_type,
}
if ((par->pextra_type == PEXTRA_NONE) &&
npar && (npar->pextra_type != PEXTRA_NONE)) {
- LString
+ string
p1 = npar->pextra_width,
p2 = npar->pextra_widthp;
npar->SetPExtraType(npar->pextra_type,
{
LyXParagraph
*par = FirstPhysicalPar(),
- *ppar = NULL,
- *npar = NULL;
+ *ppar = 0,
+ *npar = 0;
par->layout = new_layout;
- par->labelwidthstring.clean();
+ par->labelwidthstring.clear();
par->align = LYX_ALIGN_LAYOUT;
//par->depth = 0;
par->added_space_top = VSpace(VSpace::NONE);
npar = npar->Next()->NextAfterFootnote();
}
if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
- LString
+ string
p1 = ppar->pextra_width,
p2 = ppar->pextra_widthp;
ppar->SetPExtraType(ppar->pextra_type,
}
if ((par->pextra_type == PEXTRA_NONE) &&
npar && (npar->pextra_type != PEXTRA_NONE)) {
- LString
+ string
p1 = npar->pextra_width,
p2 = npar->pextra_widthp;
npar->SetPExtraType(npar->pextra_type,
{
LyXParagraph *newpar = this;
if (deth < 0)
- return NULL;
+ return 0;
do {
newpar = newpar->FirstPhysicalPar()->Previous();
if (!newpar) {
if (Previous() || GetDepth())
- lyxerr.print("ERROR (LyXParagraph::DepthHook): "
- "no hook.");
+ lyxerr << "ERROR (LyXParagraph::DepthHook): "
+ "no hook." << endl;
newpar = this;
}
return newpar->FirstPhysicalPar();
Erase(tmpi2->pos);
} else {}
else
- lyxerr.print(
- "ERROR (LyXParagraph::AutoDeleteInsets): "
- "cannot auto-delete insets");
+ lyxerr << "ERROR (LyXParagraph::AutoDeleteInsets): "
+ "cannot auto-delete insets" << endl;
}
return i;
}
Inset* LyXParagraph::ReturnNextInsetPointer(int &pos)
{
InsetTable *tmpi = insettable;
- InsetTable *tmpi2 = NULL;
+ InsetTable *tmpi2 = 0;
while (tmpi){
if (tmpi->pos >= pos) {
if (!tmpi2 || tmpi->pos < tmpi2->pos)
return tmpi2->inset;
}
else
- return NULL;
+ return 0;
}
}
-LyXParagraph* LyXParagraph::TeXOnePar(LString &file, TexRow &texrow,
- LString &foot, TexRow &foot_texrow,
+LyXParagraph* LyXParagraph::TeXOnePar(string &file, TexRow &texrow,
+ string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(LString("TeXOnePar... ") + (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
LyXParagraph *par = next;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
bool further_blank_line = false;
if (IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXOnePar) is dummy.");
+ lyxerr << "ERROR (LyXParagraph::TeXOnePar) is dummy." << endl;
if (start_of_appendix) {
file += "\\appendix\n";
texrow.newline();
}
- lyxerr.debug(LString("TeXOnePar...done ") + (long)par, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXOnePar...done " << par << endl;
return par;
}
// This one spits out the text of the paragraph
-bool LyXParagraph::SimpleTeXOnePar(LString &file, TexRow &texrow)
+bool LyXParagraph::SimpleTeXOnePar(string &file, TexRow &texrow)
{
- lyxerr.debug(LString("SimpleTeXOnePar... ") + (long)this,
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
if (table)
return SimpleTeXOneTablePar(file, texrow);
return_value = false;
}
- lyxerr.debug(LString("SimpleTeXOnePar...done ") + (long)this,
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
return return_value;
}
// This one spits out the text of a table paragraph
-bool LyXParagraph::SimpleTeXOneTablePar(LString &file, TexRow &texrow)
+bool LyXParagraph::SimpleTeXOneTablePar(string &file, TexRow &texrow)
{
- lyxerr.debug(LString("SimpleTeXOneTablePar... ")+
- (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar... " << this << endl;
char c;
int column, tmp;
tmp = table->TexEndOfCell(file, current_cell_number);
for (;tmp>0;tmp--)
texrow.newline();
- lyxerr.debug(LString("SimpleTeXOneTablePar...done ")+(long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar...done " << this << endl;
return return_value;
}
// This one spits out the text off ContRows in tables
-bool LyXParagraph::TeXContTableRows(LString &file, int i,
+bool LyXParagraph::TeXContTableRows(string &file, int i,
int current_cell_number,
int &column, TexRow &texrow)
{
- lyxerr.debug(LString("TeXContTableRows... ") +
- (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXContTableRows... " << this << endl;
if (!table)
return false;
running_font = basefont;
cell = table->CellHasContRow(current_cell_number);
}
- lyxerr.debug(LString("TeXContTableRows...done ")+(long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXContTableRows...done " << this << endl;
return return_value;
}
-bool LyXParagraph::linuxDocConvertChar(char c, LString &sgml_string)
+bool LyXParagraph::linuxDocConvertChar(char c, string &sgml_string)
{
bool retval = false;
switch (c) {
case LYX_META_HFILL:
- sgml_string.clean();
+ sgml_string.clear();
break;
case LYX_META_PROTECTED_SEPARATOR:
sgml_string = ' ';
sgml_string = "˜";
break;
case '"':
- sgml_string = "&dquot;";
+ sgml_string = """;
break;
case '\\':
sgml_string = "\";
sgml_string = ' ';
break;
case '\0': /* Ignore :-) */
- sgml_string.clean();
+ sgml_string.clear();
break;
default:
sgml_string = c;
return retval;
}
-void LyXParagraph::SimpleDocBookOneTablePar(LString &file, LString &extra,
+void LyXParagraph::SimpleDocBookOneTablePar(string &file, string &extra,
int & desc_on, int depth)
{
if (!table)
return;
- lyxerr.debug(LString("SimpleDocbookOneTablePar... ") +
- (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
int column, tmp;
- bool return_value = false;
+ //bool return_value = false; // unused
int current_cell_number = -1;
LyXFont font1,font2;
char c;
Inset *inset;
- int main_body, j;
- LString emph="emphasis";
+ int main_body; //, j; // unused
+ string emph="emphasis";
bool emph_flag=false;
int char_line_count=0;
column = 0;
} else if (c == LYX_META_INSET) {
inset = GetInset(i);
- LString tmp_out;
+ string tmp_out;
inset->DocBook(tmp_out);
//
// This code needs some explanation:
if(desc_on!=3 || i!=0) {
if(tmp_out[0]=='@') {
if(desc_on==4)
- extra += tmp_out.frontStrip('@');
+ extra += frontStrip(tmp_out, '@');
else
- file += tmp_out.frontStrip('@');
+ file += frontStrip(tmp_out, '@');
} else
file += tmp_out;
}
file += c;
char_line_count++;
} else {
- LString sgml_string;
+ string sgml_string;
if (linuxDocConvertChar(c, sgml_string)
&& !style->free_spacing) {
// in freespacing mode, spaces are
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
file += "</INFORMALTABLE>";
file += '\n';
- lyxerr.debug(LString("SimpleDocbookOneTablePar...done ") +
- (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar...done "
+ << this << endl;
}
-void LyXParagraph::DocBookContTableRows(LString &file, LString &extra,
+void LyXParagraph::DocBookContTableRows(string &file, string &extra,
int & desc_on, int i,
int current_cell_number, int &column)
{
if (!table)
return;
- lyxerr.debug(LString("DocBookContTableRows... ") +
- (long)this, Error::LATEX);
- int tmp, cell, lastpos;
+ lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
+
+ int cell, lastpos; //tmp; //unused
LyXFont font1,font2;
char c;
Inset *inset;
- int main_body, j;
- LString emph="emphasis";
+ int main_body; // , j; // unused
+ string emph="emphasis";
bool emph_flag=false;
int char_line_count=0;
}
if (c == LYX_META_INSET) {
inset = GetInset(i);
- LString tmp_out;
+ string tmp_out;
inset->DocBook(tmp_out);
//
// This code needs some explanation:
if(desc_on!=3 || i!=0) {
if(tmp_out[0]=='@') {
if(desc_on==4)
- extra += tmp_out.frontStrip('@');
+ extra += frontStrip(tmp_out, '@');
else
- file += tmp_out.frontStrip('@');
+ file += frontStrip(tmp_out, '@');
} else
file += tmp_out;
}
file += c;
char_line_count++;
} else {
- LString sgml_string;
+ string sgml_string;
if (linuxDocConvertChar(c, sgml_string)
&& !style->free_spacing) {
// in freespacing mode, spaces are
font1 = font2 = getFont(-1);
cell = table->CellHasContRow(current_cell_number);
}
- lyxerr.debug(LString("DocBookContTableRows...done ") +
- (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
}
//
-void LyXParagraph::SimpleTeXBlanks(LString &file, TexRow &texrow,
+void LyXParagraph::SimpleTeXBlanks(string &file, TexRow &texrow,
int const i, int &column, LyXFont const &font,
LyXLayout const * const style)
{
//
-void LyXParagraph::SimpleTeXSpecialChars(LString &file, TexRow &texrow,
+void LyXParagraph::SimpleTeXSpecialChars(string &file, TexRow &texrow,
LyXFont &font, LyXFont &running_font, LyXFont &basefont,
bool &open_font, LyXLayout const * const style,
int &i, int &column, char const c)
lastpos, cell;
char
c;
- LString
+ string
fname2;
FILE
*fp2;
- fname2 = TmpFileName(LString(),"RAT2");
+ fname2 = TmpFileName(string(),"RAT2");
lastpos = i;
cell = table->CellHasContRow(actcell);
actcell++;
if (c != '\0')
fprintf(fp, "%c", c);
else
- lyxerr.debug("RoffAsciiTable: NULL char in structure.");
+ lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl;
break;
}
}
return true;
}
-LyXParagraph * LyXParagraph::TeXDeeper(LString &file, TexRow &texrow,
- LString &foot, TexRow &foot_texrow,
+LyXParagraph * LyXParagraph::TeXDeeper(string &file, TexRow &texrow,
+ string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(LString("TeXDeeper... ") + (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXDeeper... " << this << endl;
LyXParagraph *par = this;
while (par && par->depth == depth) {
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXDeeper)");
+ lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
if (lyxstyle.Style(GetCurrentTextClass(),
par->layout)->isEnvironment()
|| par->pextra_type != PEXTRA_NONE)
foot_count);
}
}
- lyxerr.debug(LString("TeXDeeper...done ") + (long)par, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << endl;
return par;
}
-LyXParagraph* LyXParagraph::TeXEnvironment(LString &file, TexRow &texrow,
- LString &foot, TexRow &foot_texrow,
+LyXParagraph* LyXParagraph::TeXEnvironment(string &file, TexRow &texrow,
+ string &foot, TexRow &foot_texrow,
int &foot_count)
{
bool
char
par_sep = current_view->currentBuffer()->params.paragraph_separation;
- lyxerr.debug(LString("TeXEnvironment... ") + long(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
if (IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXEnvironment)");
+ lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
+ pextra_width + "}\n";
} else {
//float ib = atof(pextra_widthp.c_str())/100;
- // LString can't handle floats at present (971109)
+ // string can't handle floats at present (971109)
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
file += "\\begin{LyXParagraphIndent}{";
file += pextra_width + "}\n";
} else {
//float ib = atof(par->pextra_width.c_str())/100;
- // LString can't handle floats at present
+ // string can't handle floats at present
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
file += '{';
if (lyxstyle.Style(GetCurrentTextClass(),
par->layout)->isParagraph()
&& !par->table
- && !file.suffixIs("\n\n")) {
+ && !suffixIs(file, "\n\n")) {
// There should be at least one '\n' already
// but we need there to be two for Standard
// paragraphs that are depth-increment'ed to be
file += "}\n";
} else {
//float ib = atof(par->pextra_widthp.c_str())/100;
- // LString can't handle floats at present
+ // string can't handle floats at present
// so I'll do a conversion by hand knowing that
// the limits are 0.0 to 1.0. ARRae.
file += '{';
if (foot_count >= 1) {
if (foot_count > 1) {
file += "\\addtocounter{footnote}{-";
- file += foot_count - 1;
+ file += tostr(foot_count - 1);
file += '}';
}
file += foot;
texrow += foot_texrow;
- foot.clean();
+ foot.clear();
foot_texrow.reset();
foot_count = 0;
}
file += '\n';
texrow.newline();
}
- lyxerr.debug(LString("TeXEnvironment...done ")
- + (long)par, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
return par; // ale970302
}
-LyXParagraph * LyXParagraph::TeXFootnote(LString &file, TexRow &texrow,
- LString &foot, TexRow &foot_texrow,
+LyXParagraph * LyXParagraph::TeXFootnote(string &file, TexRow &texrow,
+ string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(LString("TeXFootnote... ")
- + (long)this, Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXFootnote... " << this << endl;
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "No footnote!");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "No footnote!" << endl;
LyXParagraph *par = this;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(),
previous->GetLayout());
if (style->needprotect && footnotekind != LyXParagraph::FOOTNOTE){
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "Float other than footnote in command"
- " with moving argument is illegal");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "Float other than footnote in command"
+ " with moving argument is illegal" << endl;
}
if (footnotekind != LyXParagraph::FOOTNOTE
&& footnotekind != LyXParagraph::MARGIN
&& file.length()
- && !file.suffixIs('\n')) {
+ && !suffixIs(file, '\n')) {
// we need to ensure that real floats like tables and figures
// have their \begin{} on a new line otherwise we can get
// incorrect results when using the endfloat.sty package
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
+ << endl;
if (style->isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments.
// process footnotes > depth 0 or in environments separately
// NOTE: Currently don't support footnotes within footnotes
// even though that is possible using the \footnotemark
- LString dummy;
+ string dummy;
TexRow dummy_texrow;
int dummy_count = 0;
do {
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
+ << endl;
if (style->isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments.
}
} while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
if (dummy_count) {
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "Footnote in a Footnote -- not supported");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "Footnote in a Footnote -- not supported"
+ << endl;
}
}
texrow.newline();
}
- lyxerr.debug(LString("TeXFootnote...done ") +
- long(par->next), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXFootnote...done " << par->next << endl;
return par;
}
return;
pextra_type = PEXTRA_NONE;
- pextra_width.clean();
- pextra_widthp.clean();
+ pextra_width.clear();
+ pextra_widthp.clear();
if (lyxstyle.Style(GetCurrentTextClass(),
layout)->isEnvironment()) {
par = ppar;
while (par && (par->layout == layout) && (par->depth == depth)) {
par->pextra_type = PEXTRA_NONE;
- par->pextra_width.clean();
- par->pextra_widthp.clean();
+ par->pextra_width.clear();
+ par->pextra_widthp.clear();
par = par->NextAfterFootnote();
if (par && (par->depth > depth))
par->UnsetPExtraType();