/* 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 <ctype.h>
+#include <cctype>
#include FORMS_H_LOCATION
#ifdef __GNUG__
#include "insets/inseterror.h"
#include "layout.h"
#include "LyXView.h"
-#include "textutils.h"
+#include "support/textutils.h"
#include "lyx_cb.h"
#include "undo.h"
#include "minibuffer.h"
#include "lyxtext.h"
#include "gettext.h"
-// $Id: text2.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: text2.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
-#endif /* lint */
-
extern MiniBuffer *minibuffer;
// Constructor
LyXText::LyXText(int pw, Buffer *p)
{
- firstrow = NULL;
- lastrow = NULL;
- currentrow = NULL;
+ firstrow = 0;
+ lastrow = 0;
+ currentrow = 0;
currentrow_y = 0;
paperwidth = pw;
parameters = &p->params;
mark_set = false;
/* no rebreak necessary */
- need_break_row = NULL;
+ need_break_row = 0;
undo_finished = true;
undo_frozen = false;
{
Row *tmprow = new Row;
if (!row) {
- tmprow->previous = NULL;
+ tmprow->previous = 0;
tmprow->next = firstrow;
firstrow = tmprow;
}
if (row->next)
tmppar = row->next->par;
else
- tmppar = NULL;
+ tmppar = 0;
}
AppendParagraph(cursor.row);
if (tmprow->next)
tmppar = tmprow->next->par;
else
- tmppar = NULL;
+ tmppar = 0;
while (tmppar != endpar) {
RemoveRow(tmprow->next);
if (tmprow->next)
tmppar = tmprow->next->par;
else
- tmppar = NULL;
+ tmppar = 0;
}
/* remove the first one */
tmprow2 = tmprow; /* this is because tmprow->previous
- * can be NULL */
+ * can be 0 */
tmprow = tmprow->previous;
RemoveRow(tmprow2);
{
if (need_break_row) {
BreakAgain(need_break_row);
- need_break_row = NULL;
+ need_break_row = 0;
return 1;
}
return 0;
bool pagebreak_top, bool pagebreak_bottom,
VSpace space_top, VSpace space_bottom,
char align,
- LString labelwidthstring,
+ string labelwidthstring,
bool noindent)
{
LyXCursor tmpcursor;
}
if (!par->labelstring.empty()) {
- par->labelstring.clean();
+ par->labelstring.clear();
}
if (layout->margintype == MARGIN_MANUAL) {
}
}
else {
- par->SetLabelWidthString(LString());
+ par->SetLabelWidthString(string());
}
/* is it a layout that has an automatic label ? */
if (!layout->labelstring.empty())
par->labelstring = layout->labelstring;
else
- par->labelstring.clean();
+ par->labelstring.clear();
}
else {
if (!layout->labelstring_appendix.empty())
par->labelstring = layout->labelstring_appendix;
else
- par->labelstring.clean();
+ par->labelstring.clear();
}
if (!par->appendix){
// In biblio should't be following counters but...
}
else {
- LString s = layout->labelstring;
+ string s = layout->labelstring;
/* the caption hack: */
/* this is for the simple cut and paste mechanism */
-static LyXParagraph *simple_cut_buffer = NULL;
+static LyXParagraph *simple_cut_buffer = 0;
static char simple_cut_buffer_textclass = 0;
void DeleteSimpleCutBuffer()
simple_cut_buffer = simple_cut_buffer->next;
delete tmppar;
}
- simple_cut_buffer = NULL;
+ simple_cut_buffer = 0;
}
/*store the selection */
simple_cut_buffer = sel_start_cursor.par->ParFromPos(sel_start_cursor.pos)->next;
- simple_cut_buffer->previous = NULL;
- sel_end_cursor.par->previous->next = NULL;
+ simple_cut_buffer->previous = 0;
+ sel_end_cursor.par->previous->next = 0;
/* cut the selection */
sel_start_cursor.par->ParFromPos(sel_start_cursor.pos)->next
tmppar2->next->previous = tmppar2;
tmppar2=tmppar2->next;
}
- tmppar2->next = NULL;
+ tmppar2->next = 0;
/* care about footnotes */
if (simple_cut_buffer->footnoteflag) {
int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2,
LyXParagraph *par)
{
- InsetError * new_inset = NULL;
+ InsetError * new_inset = 0;
int ret = 0;
if (!par || class1 == class2)
return ret;
par = par->FirstPhysicalPar();
while (par) {
- LString name = lyxstyle.NameOfLayout(class1, par->layout);
+ string name = lyxstyle.NameOfLayout(class1, par->layout);
int lay = lyxstyle.NumberOfLayout(class2, name);
if (lay == -1) // layout not found
// use default layout "Stadard" (0)
if (name != lyxstyle.NameOfLayout(class2, par->layout)) {
ret++;
- LString s= "Layout had to be changed from\n"
+ string s= "Layout had to be changed from\n"
+ name + " to " + lyxstyle.NameOfLayout(class2, par->layout)
+ "\nbecause of class conversion from\n"
+ lyxstyle.NameOfClass(class1) + " to "
pos = par->PositionInParFromPos(pos);
par = tmppar;
}
- if (par->IsDummy() && par->previous &&
+ if (par->IsDummy() && par->previous &&
par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- while (par->previous &&
- par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE){
+ while (par->previous &&
+ ((par->previous->IsDummy() && par->previous->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) ||
+ (par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE))) {
par = par->previous ;
+ if (par->IsDummy() &&
+ par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
+ pos += par->last + 1;
}
if (par->previous) {
par = par->previous;
// replace the paragraphs with the undo informations
tmppar3 = undo->par;
- undo->par = NULL; // otherwise the undo destructor would delete the paragraph
+ undo->par = 0; // otherwise the undo destructor would delete the paragraph
tmppar4 = tmppar3;
if (tmppar4){
while (tmppar4->next)
// is stored in the undo. So restore the text informations.
if (undo->kind == Undo::EDIT){
tmppar2->text = tmppar->text;
- tmppar->text = NULL;
+ tmppar->text = 0;
tmppar2 = tmppar2->next;
}
if ( currentrow && currentrow->par == tmppar )
params->undostack.Top()->number_of_before_par == before_number &&
params->undostack.Top()->number_of_behind_par == behind_number ){
// no undo needed
- return NULL;
+ return 0;
}
}
// create a new Undo
LyXParagraph* tmppar;
LyXParagraph *tmppar2;
- LyXParagraph* start = NULL;
- LyXParagraph* end = NULL;
+ LyXParagraph* start = 0;
+ LyXParagraph* end = 0;
if (before)
start = before->next;
if (kind == Undo::EDIT){
if (tmppar2->text)
delete[] tmppar2->text;
- tmppar2->text = NULL;
+ tmppar2->text = 0;
}
undopar = tmppar2;
if (kind == Undo::EDIT){
if (tmppar2->next->text)
delete[] tmppar2->next->text;
- tmppar2->next->text = NULL;
+ tmppar2->next->text = 0;
}
tmppar2->next->previous = tmppar2;
tmppar2=tmppar2->next;
}
- tmppar2->next = NULL;
+ tmppar2->next = 0;
}
else
- undopar = NULL; // nothing to replace (undo of delete maybe)
+ undopar = 0; // nothing to replace (undo of delete maybe)
int cursor_par = cursor.par->ParFromPos(cursor.pos)->GetID();
int cursor_pos = cursor.par->PositionInParFromPos(cursor.pos);