filters
listtable.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 <kdebug.h> /* for kdDebug stream */ 00023 #include "listtable.h" 00024 00025 /*******************************************/ 00026 /* Constructor */ 00027 /*******************************************/ 00028 ListTable::ListTable() 00029 { 00030 00031 } 00032 00033 /*******************************************/ 00034 /* Destructor */ 00035 /*******************************************/ 00036 ListTable::~ListTable() 00037 { 00038 /* Just call the parent destructor */ 00039 } 00040 00041 /*******************************************/ 00042 /* IsNewTable */ 00043 /*******************************************/ 00044 Table* ListTable::isNewTable(QString grpMgr) 00045 { 00046 Table *current = 0; 00047 00048 /* Parcourir les tables et tester chaque nom de table */ 00049 for(current = first(); current != 0; current = next()) 00050 { 00051 if(current->getGrpMgr() == grpMgr) 00052 return current; 00053 } 00054 return 0; 00055 } 00056 00057 /*******************************************/ 00058 /* add */ 00059 /*******************************************/ 00060 void ListTable::add(Element* elt) 00061 { 00062 Table* newTable = 0; 00063 /* If the GrpMng exist in one element 00064 * update it 00065 * else 00066 * add 00067 */ 00068 if((newTable = isNewTable(elt->getGrpMgr())) == 0) 00069 { 00070 kdDebug(30522) << "NEW TABLE !!" << endl; 00071 newTable = new Table(elt->getGrpMgr()); 00072 newTable->append(elt); 00073 append(newTable); 00074 } 00075 else 00076 { 00077 kdDebug(30522) << "UPDATE TABLE : " << elt->getGrpMgr() << endl; 00078 newTable->append(elt); 00079 } 00080 } 00081