filters

FilterPage.h
1/*
2 * Copyright (c) 2002-2003 Nicolas HADACEK (hadacek@kde.org)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8
9 * This program 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
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef FILTERPAGE_H
21#define FILTERPAGE_H
22
23#include "TextOutputDev.h"
24
25#include <tqdatetime.h>
26#include <tqptrlist.h>
27
28#include "fstring.h"
29
30
31namespace PDFImport
32{
33
34class Paragraph;
35class Data;
36
37class Page : public TextPage
38{
39public:
40 Page(Data &data);
41
42 TQValueVector<DRect> &rects() { return _rects; }
43 bool hasHeader() const;
44 bool hasFooter() const;
45
46 void clear();
47
48 // first pass
49 void beginString(GfxState *, double x0, double y0);
50 void addString(TextString *);
51 void endString();
52 void addLink(Link *link) { _links.append(link); }
53 void endPage();
54
55 // second pass
56 void dump();
57
58public:
59 TQValueList<TQDomElement> pictures;
60
61private:
62 FontFamily checkSpecial(TQChar &, const Font &) const;
63 static TextBlock *block(TextLine *, int index);
64 static bool isLastParagraphLine(TextLine *, const Paragraph &);
65
66 // first pass
67 void createParagraphs();
68 void checkHeader();
69 void checkFooter();
70
71 // second pass
72 void initParagraph(Paragraph &) const;
73 void fillParagraph(Paragraph &, double &offset) const;
74 void checkSpecialChars(Paragraph &) const;
75 void coalesce(Paragraph &) const;
76 void prepare();
77 void dump(const Paragraph &);
78
79private:
80 Data &_data;
81 TQValueList<Paragraph> _pars;
82 TQPtrList<Link> _links;
83 String *_lastStr;
84 TQTime _time; // debug
85 TQValueVector<DRect> _rects;
86};
87
88} // namespace
89
90#endif