~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/dom/lsimpl.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __LSIMPL_H__
 
2
#define __LSIMPL_H__
 
3
/**
 
4
 * Phoebe DOM Implementation.
 
5
 *
 
6
 * This is a C++ approximation of the W3C DOM model, which follows
 
7
 * fairly closely the specifications in the various .idl files, copies of
 
8
 * which are provided for reference.  Most important is this one:
 
9
 *
 
10
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
 
11
 *
 
12
 * Authors:
 
13
 *   Bob Jamison
 
14
 *
 
15
 * Copyright (C) 2005-2007 Bob Jamison
 
16
 *
 
17
 *  This library is free software; you can redistribute it and/or
 
18
 *  modify it under the terms of the GNU Lesser General Public
 
19
 *  License as published by the Free Software Foundation; either
 
20
 *  version 2.1 of the License, or (at your option) any later version.
 
21
 *
 
22
 *  This library is distributed in the hope that it will be useful,
 
23
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
24
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
25
 *  Lesser General Public License for more details.
 
26
 *
 
27
 *  You should have received a copy of the GNU Lesser General Public
 
28
 *  License along with this library; if not, write to the Free Software
 
29
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
30
 */
 
31
 
 
32
#include "domimpl.h"
 
33
#include "events.h"
 
34
#include "traversal.h"
 
35
#include "ls.h"
 
36
 
 
37
 
 
38
#include "xmlreader.h"
 
39
 
 
40
namespace org
 
41
{
 
42
namespace w3c
 
43
{
 
44
namespace dom
 
45
{
 
46
namespace ls
 
47
{
 
48
 
 
49
 
 
50
/*#########################################################################
 
51
## LSParserImpl
 
52
#########################################################################*/
 
53
 
 
54
/**
 
55
 *
 
56
 */
 
57
class LSParserImpl : virtual public LSParser
 
58
{
 
59
public:
 
60
 
 
61
    typedef enum
 
62
        {
 
63
        PARSE_AS_DATA     = 0,
 
64
        PARSE_AS_DOCUMENT = 1
 
65
        } ParsingModes;
 
66
 
 
67
   /**
 
68
     *
 
69
     */
 
70
    virtual bool getBusy();
 
71
 
 
72
    /**
 
73
     *
 
74
     */
 
75
    virtual DocumentPtr parse(const LSInput &input)
 
76
                              throw(dom::DOMException, LSException);
 
77
 
 
78
 
 
79
    /**
 
80
     *
 
81
     */
 
82
    virtual DocumentPtr parseURI(const DOMString &uri)
 
83
                                 throw(dom::DOMException, LSException);
 
84
 
 
85
   /**
 
86
     *
 
87
     */
 
88
    virtual NodePtr parseWithContext(const LSInput &input,
 
89
                                     const NodePtr contextArg,
 
90
                                     unsigned short action)
 
91
                                     throw(dom::DOMException, LSException);
 
92
 
 
93
 
 
94
    //##################
 
95
    //# Non-API methods
 
96
    //##################
 
97
 
 
98
    /**
 
99
     *
 
100
     */
 
101
    LSParserImpl()
 
102
        {}
 
103
 
 
104
    /**
 
105
     *
 
106
     */
 
107
    LSParserImpl(const LSParserImpl &other) : LSParser(other)
 
108
        {}
 
109
 
 
110
    /**
 
111
     *
 
112
     */
 
113
    virtual ~LSParserImpl()
 
114
        {}
 
115
 
 
116
 
 
117
 
 
118
    //##################
 
119
    //# Internals
 
120
    //##################
 
121
 
 
122
 
 
123
protected:
 
124
 
 
125
    XmlReader reader;
 
126
    LSParserFilter *filter;
 
127
 
 
128
};
 
129
 
 
130
 
 
131
 
 
132
 
 
133
/*#########################################################################
 
134
## LSParserFilterImpl
 
135
#########################################################################*/
 
136
 
 
137
/**
 
138
 *
 
139
 */
 
140
class LSParserFilterImpl : virtual public LSParserFilter
 
141
{
 
142
public:
 
143
 
 
144
    /**
 
145
     *
 
146
     */
 
147
    virtual unsigned short startElement(const ElementPtr /*elementArg*/)
 
148
        { return 0; }
 
149
 
 
150
    /**
 
151
     *
 
152
     */
 
153
    virtual unsigned short acceptNode(const NodePtr /*nodeArg*/)
 
154
        { return 0; }
 
155
 
 
156
    /**
 
157
     *
 
158
     */
 
159
    virtual unsigned long getWhatToShow()
 
160
        { return 0; }
 
161
 
 
162
    //##################
 
163
    //# Non-API methods
 
164
    //##################
 
165
 
 
166
    /**
 
167
     *
 
168
     */
 
169
    virtual ~LSParserFilterImpl()
 
170
        {}
 
171
 
 
172
 
 
173
 
 
174
};
 
175
 
 
176
/*#########################################################################
 
177
## LSSerializerImpl
 
178
#########################################################################*/
 
179
 
 
180
/**
 
181
 *
 
182
 */
 
183
class LSSerializerImpl : virtual public LSSerializer
 
184
{
 
185
public:
 
186
 
 
187
 
 
188
    /**
 
189
     *
 
190
     */
 
191
    virtual bool write(const NodePtr nodeArg,
 
192
                       const LSOutput &destination)
 
193
                       throw (LSException);
 
194
 
 
195
    /**
 
196
     *
 
197
     */
 
198
    virtual bool writeToURI(const NodePtr nodeArg,
 
199
                            const DOMString &uri)
 
200
                            throw(LSException);
 
201
 
 
202
    /**
 
203
     *
 
204
     */
 
205
    virtual DOMString writeToString(const NodePtr nodeArg)
 
206
                                    throw(dom::DOMException, LSException);
 
207
 
 
208
    //##################
 
209
    //# Non-API methods
 
210
    //##################
 
211
 
 
212
    /**
 
213
     *
 
214
     */
 
215
    LSSerializerImpl()
 
216
        {
 
217
        indent = 0;
 
218
        }
 
219
 
 
220
    /**
 
221
     *
 
222
     */
 
223
    virtual ~LSSerializerImpl()
 
224
        {}
 
225
 
 
226
 
 
227
 
 
228
protected:
 
229
 
 
230
    /**
 
231
     *
 
232
     */
 
233
    void writeNode(const NodePtr nodeArg);
 
234
 
 
235
private:
 
236
 
 
237
    void spaces();
 
238
 
 
239
    void po(char const *fmt, ...)
 
240
    #ifdef G_GNUC_PRINTF
 
241
    G_GNUC_PRINTF(2, 3)
 
242
    #endif
 
243
    ;
 
244
 
 
245
    void pos(const DOMString &str);
 
246
 
 
247
    void poxml(const DOMString &str);
 
248
 
 
249
    DOMString          outbuf;
 
250
 
 
251
    int                indent;
 
252
 
 
253
    DOMConfiguration   *domConfig;
 
254
 
 
255
    LSSerializerFilter *filter;
 
256
 
 
257
 
 
258
 
 
259
};
 
260
 
 
261
 
 
262
 
 
263
 
 
264
/*#########################################################################
 
265
## LSSerializerFilterImpl
 
266
#########################################################################*/
 
267
 
 
268
/**
 
269
 *
 
270
 */
 
271
class LSSerializerFilterImpl : virtual public LSSerializerFilter
 
272
{
 
273
public:
 
274
 
 
275
    /**
 
276
     *
 
277
     */
 
278
    virtual unsigned long  getWhatToShow()
 
279
        { return 0; }
 
280
 
 
281
    //##################
 
282
    //# Non-API methods
 
283
    //##################
 
284
 
 
285
    /**
 
286
     *
 
287
     */
 
288
    virtual ~LSSerializerFilterImpl()
 
289
        {}
 
290
};
 
291
 
 
292
 
 
293
 
 
294
/*#########################################################################
 
295
## DOMImplementationLSImpl
 
296
#########################################################################*/
 
297
 
 
298
/**
 
299
 *
 
300
 */
 
301
class DOMImplementationLSImpl : virtual public DOMImplementationLS
 
302
{
 
303
public:
 
304
 
 
305
    /**
 
306
     *
 
307
     */
 
308
    virtual LSParser &createLSParser(unsigned short /*mode*/,
 
309
                                     const DOMString &/*schemaType*/)
 
310
                                     throw (dom::DOMException)
 
311
        {
 
312
        LSParserImpl newParser;
 
313
        parser = newParser;
 
314
        return parser;
 
315
        }
 
316
 
 
317
 
 
318
    /**
 
319
     *
 
320
     */
 
321
    virtual LSSerializer &createLSSerializer()
 
322
        {
 
323
        LSSerializerImpl newSerializer;
 
324
        serializer = newSerializer;
 
325
        return serializer;
 
326
        }
 
327
 
 
328
 
 
329
    /**
 
330
     *
 
331
     */
 
332
    virtual LSInput createLSInput()
 
333
        {
 
334
        LSInput input;
 
335
        return input;
 
336
        }
 
337
 
 
338
    /**
 
339
     *
 
340
     */
 
341
    virtual LSOutput createLSOutput()
 
342
        {
 
343
        LSOutput output;
 
344
        return output;
 
345
        }
 
346
 
 
347
    //##################
 
348
    //# Non-API methods
 
349
    //##################
 
350
 
 
351
    /**
 
352
     *
 
353
     */
 
354
    virtual ~DOMImplementationLSImpl() {}
 
355
 
 
356
protected:
 
357
 
 
358
    LSParserImpl     parser;
 
359
    LSSerializerImpl serializer;
 
360
};
 
361
 
 
362
 
 
363
 
 
364
 
 
365
 
 
366
 
 
367
}  //namespace ls
 
368
}  //namespace dom
 
369
}  //namespace w3c
 
370
}  //namespace org
 
371
 
 
372
 
 
373
 
 
374
 
 
375
#endif   /* __LSIMPL_H__ */
 
376
 
 
377
/*#########################################################################
 
378
## E N D    O F    F I L E
 
379
#########################################################################*/
 
380