~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kword/latex/export/listeformat.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* BUGS : latex don't support alpha list with one command !!! the
 
3
 * command generated doesn't exist :))))
 
4
 */
 
5
 
 
6
/*
 
7
** A program to convert the XML rendered by KWord into LATEX.
 
8
**
 
9
** Copyright (C) 2000 Robert JACOLIN
 
10
**
 
11
** This library is free software; you can redistribute it and/or
 
12
** modify it under the terms of the GNU Library General Public
 
13
** License as published by the Free Software Foundation; either
 
14
** version 2 of the License, or (at your option) any later version.
 
15
**
 
16
** This library is distributed in the hope that it will be useful,
 
17
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
** Library General Public License for more details.
 
20
**
 
21
** To receive a copy of the GNU Library General Public License, write to the
 
22
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
23
** Boston, MA  02111-1307, USA.
 
24
**
 
25
*/
 
26
 
 
27
#include <kdebug.h>             /* for kdDebug() stream */
 
28
#include "listeformat.h"
 
29
 
 
30
/* PRIVATE METHODS         */
 
31
 
 
32
/* PROTECTED METHODS       */
 
33
 
 
34
/* PUBLIC METHODS          */
 
35
 
 
36
/* Constructors            */
 
37
 
 
38
/* Destructors             */
 
39
FormatElt::~FormatElt()
 
40
{
 
41
        kdDebug() << "Destruction d'un elementT" << endl;
 
42
        remFormat();
 
43
}
 
44
 
 
45
/* Accessors               */
 
46
 
 
47
/* Modifiors               */
 
48
void FormatElt::setFormat(Format* format)
 
49
{
 
50
        _format = format;       
 
51
}
 
52
 
 
53
void FormatElt::remFormat()
 
54
{
 
55
        delete _format;
 
56
        _format = 0;
 
57
}
 
58
 
 
59
void FormatElt::setNext(FormatElt* next)
 
60
{
 
61
        _next = next;
 
62
}
 
63
 
 
64
void FormatElt::remNext()
 
65
{
 
66
        delete _next;
 
67
        _next = 0;
 
68
}
 
69
 
 
70
/* Operators               */
 
71
FormatElt& FormatElt::operator = (const FormatElt & elt)
 
72
{
 
73
        _format = elt.getFormat();
 
74
        _next   = elt.getNext();
 
75
        return *this;
 
76
}
 
77
 
 
78
//////////////////////////////////////////////////////////
 
79
ListeFormat::ListeFormat()
 
80
{
 
81
        kdDebug() << "Create format list" << endl;
 
82
        _first  = 0;
 
83
        _end    = 0;
 
84
        _size   = 0;
 
85
}
 
86
 
 
87
ListeFormat::~ListeFormat()
 
88
{
 
89
        kdDebug() << "Destruction of a list of format" << endl;
 
90
        vider();
 
91
        kdDebug() << "ok" << endl;
 
92
}
 
93
 
 
94
void ListeFormat::addLast(Format *elt)
 
95
{
 
96
 
 
97
        FormatElt *new_last = new FormatElt;
 
98
 
 
99
        new_last->setFormat(elt);
 
100
 
 
101
        if(_first != 0)
 
102
        {
 
103
                _end->setNext(new_last);
 
104
                _end = new_last;
 
105
        }
 
106
        else
 
107
        {
 
108
                /* La liste est vide => _last = _first; */
 
109
                _end  = new_last;
 
110
                _first = _end;
 
111
        }       
 
112
        _size = _size + 1;
 
113
}
 
114
 
 
115
void ListeFormat::addFirst(Format* elt)
 
116
{
 
117
        FormatElt *new_first = new FormatElt;
 
118
 
 
119
        new_first->setFormat(elt);
 
120
        new_first->setNext(_first);
 
121
 
 
122
        _first = new_first;
 
123
        if(_size == 0)
 
124
        {
 
125
                /* La liste est vide => _last = _first; */
 
126
                _end = _first;
 
127
        }       
 
128
        _size = _size + 1;
 
129
}
 
130
 
 
131
void ListeFormat::remLast()
 
132
{
 
133
        FormatElt *new_last = new FormatElt(_first);
 
134
        
 
135
        for(int index = 1; index< _size - 1; new_last = new_last->getNext())
 
136
        { }
 
137
        
 
138
        delete _end;
 
139
        _end = new_last;
 
140
        _size = _size - 1;
 
141
}
 
142
 
 
143
void ListeFormat::remFirst()
 
144
{
 
145
        FormatElt *first_saved;
 
146
 
 
147
        first_saved = _first->getNext();
 
148
 
 
149
        delete _first;
 
150
        _first = first_saved;
 
151
        _size  = _size - 1;
 
152
}
 
153
 
 
154
void ListeFormat::vider()
 
155
{
 
156
        while(_first != 0)
 
157
        {
 
158
                remFirst();
 
159
        }
 
160
}
 
161