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

« back to all changes in this revision

Viewing changes to filters/kword/latex/import/parser/command.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
/* This file is part of the KDE project
 
2
 * Copyright (C) 2003 Robert JACOLIN <rjacolin@ifrance.com>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Library General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Library General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Library General Public License
 
15
 * along with this library; see the file COPYING.LIB.  If not, write to
 
16
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#include "command.h"
 
21
#include <iostream.h>
 
22
#include "kdebug.h"
 
23
 
 
24
Command::Command()
 
25
{
 
26
        setType(Element::LATEX_COMMAND);
 
27
        _options.setAutoDelete(true);
 
28
        _params.setAutoDelete(true);
 
29
}
 
30
 
 
31
Command::Command(const char* name)
 
32
{
 
33
        setType(Element::LATEX_COMMAND);
 
34
        _options.setAutoDelete(true);
 
35
        _params.setAutoDelete(true);
 
36
        _name = name;
 
37
        _name = _name.stripWhiteSpace();
 
38
}
 
39
 
 
40
Command::Command(const char* name, QPtrList<QPtrList<Element> >* groups)
 
41
{
 
42
        setType(Element::LATEX_COMMAND);
 
43
        _options.setAutoDelete(true);
 
44
        _params.setAutoDelete(true);
 
45
        _name = name;
 
46
        if(groups != NULL)
 
47
                _elements = *groups;
 
48
        _name = _name.stripWhiteSpace();
 
49
}
 
50
 
 
51
Command::Command(const char* name, QPtrList<QPtrList<Param> >* params,
 
52
                QPtrList<QPtrList<Element> >* groups)
 
53
{
 
54
        setType(Element::LATEX_COMMAND);
 
55
        _options.setAutoDelete(true);
 
56
        _params.setAutoDelete(true);
 
57
        _name = name;
 
58
        if(groups != NULL)
 
59
                _elements = *groups;
 
60
        if(params != NULL)
 
61
                _params = *params;
 
62
        _name = _name.stripWhiteSpace();
 
63
}
 
64
 
 
65
Command::Command(const char* name, QPtrList<QPtrList<Param> >* params, QPtrList<Param>* options,
 
66
                QPtrList<QPtrList<Element> >* groups)
 
67
{
 
68
        setType(Element::LATEX_COMMAND);
 
69
        _options.setAutoDelete(true);
 
70
        _params.setAutoDelete(true);
 
71
        _name = name;
 
72
        if(groups != NULL)
 
73
                _elements = *groups;
 
74
        if(params != NULL)
 
75
                _params = *params;
 
76
        if(options != NULL)
 
77
                _options = *options;
 
78
        _name = name;
 
79
        _name = _name.stripWhiteSpace();
 
80
}
 
81
 
 
82
Command::~Command()
 
83
{
 
84
}
 
85
 
 
86
void Command::addParam(const char* )
 
87
{
 
88
        /*QString test = QString(name);
 
89
        QString key = test.left(test.find("="));
 
90
        QString value = test.right(test.find("="));
 
91
        addParam(key, value);*/
 
92
}
 
93
 
 
94
void Command::addOption(const char* )
 
95
{
 
96
        /*QString test = QString(name);
 
97
        QString key = test.left(test.find("="));
 
98
        QString value = test.right(test.find("="));
 
99
        addOption(key, value);*/
 
100
}
 
101
 
 
102
void Command::print(int tab)
 
103
{
 
104
        cout << _name.latin1();
 
105
        QPtrList<Param>* params;
 
106
        for ( params = _params.first(); params; params = _params.next() )
 
107
        {
 
108
                cout << "[";
 
109
                Param* param;
 
110
                for ( param = params->first(); param; param = params->next() )
 
111
                {
 
112
                        param->print(tab);
 
113
                        if(param != params->getLast())
 
114
                                cout << ", ";
 
115
                }
 
116
                cout << "]";
 
117
        }
 
118
        if(_options.count() > 0)
 
119
        {
 
120
                cout << " - [";
 
121
                Param* param;
 
122
                for ( param = _options.first(); param; param = _options.next() )
 
123
                {
 
124
                        param->print(tab);
 
125
                        if(param != _options.getLast())
 
126
                        cout << ", ";
 
127
                }
 
128
                cout << "]";
 
129
        }
 
130
        
 
131
        QPtrList<Element>* group;
 
132
        for(group = _elements.first(); group; group = _elements.next() )
 
133
        {
 
134
                cout << " {";
 
135
                Element* elt;
 
136
                for ( elt = group->first(); elt; elt = group->next() )
 
137
                {
 
138
                        elt->print(tab);
 
139
                }
 
140
                cout << "}";
 
141
        }
 
142
        cout << endl;
 
143
}