filters

FilterPage.h

00001 /*
00002  * Copyright (c) 2002-2003 Nicolas HADACEK (hadacek@kde.org)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef FILTERPAGE_H
00021 #define FILTERPAGE_H
00022 
00023 #include "TextOutputDev.h"
00024 
00025 #include <qdatetime.h>
00026 #include <qptrlist.h>
00027 
00028 #include "fstring.h"
00029 
00030 
00031 namespace PDFImport
00032 {
00033 
00034 class Paragraph;
00035 class Data;
00036 
00037 class Page : public TextPage
00038 {
00039 public:
00040     Page(Data &data);
00041 
00042     QValueVector<DRect> &rects() { return _rects; }
00043     bool hasHeader() const;
00044     bool hasFooter() const;
00045 
00046     void clear();
00047 
00048     // first pass
00049     void beginString(GfxState *, double x0, double y0);
00050     void addString(TextString *);
00051     void endString();
00052     void addLink(Link *link) { _links.append(link); }
00053     void endPage();
00054 
00055     // second pass
00056     void dump();
00057 
00058 public:
00059     QValueList<QDomElement> pictures;
00060 
00061 private:
00062     FontFamily checkSpecial(QChar &, const Font &) const;
00063     static TextBlock *block(TextLine *, int index);
00064     static bool isLastParagraphLine(TextLine *, const Paragraph &);
00065 
00066     // first pass
00067     void createParagraphs();
00068     void checkHeader();
00069     void checkFooter();
00070 
00071     // second pass
00072     void initParagraph(Paragraph &) const;
00073     void fillParagraph(Paragraph &, double &offset) const;
00074     void checkSpecialChars(Paragraph &) const;
00075     void coalesce(Paragraph &) const;
00076     void prepare();
00077     void dump(const Paragraph &);
00078 
00079 private:
00080     Data &_data;
00081     QValueList<Paragraph> _pars;
00082     QPtrList<Link> _links;
00083     String *_lastStr;
00084     QTime _time; // debug
00085     QValueVector<DRect> _rects;
00086 };
00087 
00088 } // namespace
00089 
00090 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys