filters

listepara.cc

00001 /*
00002 ** A program to convert the XML rendered by KWord into LATEX.
00003 **
00004 ** Copyright (C) 2000 Robert JACOLIN
00005 **
00006 ** This library is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU Library General Public
00008 ** License as published by the Free Software Foundation; either
00009 ** version 2 of the License, or (at your option) any later version.
00010 **
00011 ** This library is distributed in the hope that it will be useful,
00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 ** Library General Public License for more details.
00015 **
00016 ** To receive a copy of the GNU Library General Public License, write to the
00017 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 **
00020 */
00021 
00022 #include <stdlib.h>     /* for atoi function */
00023 #include <kdebug.h>     /* for kdDebug() stream */
00024 #include "listepara.h"
00025 
00026 ListPara::ListPara()
00027 {
00028     kdDebug(30522) << "Create liste para empty" << endl;
00029     _start  = 0;
00030     _end    = 0;
00031     _size   = 0;
00032 }
00033 
00034 ListPara::~ListPara()
00035 {
00036     kdDebug(30522) << "Destruction of a list of parag" << endl;
00037     vider();
00038     kdDebug(30522) << "ok" << endl;
00039 }
00040 
00041 void ListPara::initialiser(Para *elt)
00042 {
00043     kdDebug(30522) << "initialise a list of parag at " << elt << endl;
00044     _end = _start = elt;
00045 }
00046 
00047 void ListPara::add(Para *elt)
00048 {
00049     if(_start == 0)
00050     {
00051         initialiser(elt);
00052         _size = 1;
00053     }
00054     else
00055     {
00056         kdDebug(30522) << "add a parag." << endl;
00057         _end->setNext(elt);
00058         elt->setPrevious(_end);
00059         _end  = elt;
00060         _size = _size + 1;
00061     }
00062 }
00063 
00064 void ListPara::rem()
00065 {
00066     Para *first_saved = 0;
00067 
00068     first_saved = _start;
00069     _start      = _start->getNext();
00070     delete first_saved;
00071     _size  = _size - 1;
00072 }
00073 
00074 void ListPara::vider()
00075 {
00076     while(_start != 0)
00077     {
00078         rem();
00079     }
00080 }
00081 
KDE Home | KDE Accessibility Home | Description of Access Keys