filters

data.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 DATA_H
00021 #define DATA_H
00022 
00023 #include <math.h>
00024 
00025 #include <qdom.h>
00026 #include <qvaluevector.h>
00027 
00028 #include <KoPageLayout.h>
00029 
00030 #include "misc.h"
00031 
00032 class KoFilterChain;
00033 
00034 
00035 namespace PDFImport
00036 {
00037 class Options;
00038 
00039 class Data
00040 {
00041 public:
00042     Data(KoFilterChain *, const DRect &pageRect, KoPageLayout,
00043          const Options &);
00044 
00045     QDomElement createElement(const QString &name)
00046         { return _document.createElement(name); }
00047     void createParagraph(const QString &text, ParagraphType type,
00048                          const QValueVector<QDomElement> &layouts,
00049                          const QValueVector<QDomElement> &formats);
00050 
00051     KoFilterChain *chain() const { return _chain; }
00052     const Options &options() const { return _options; }
00053     QDomDocument document() const { return _document; }
00054     const DRect &pageRect() const { return _pageRect; }
00055     uint imageIndex() const { return _imageIndex; }
00056     uint textIndex() const { return _textIndex; }
00057     QDomElement bookmarks() const { return _bookmarks; }
00058     QDomElement pictures() const { return _pictures; }
00059 
00060     QDomElement pictureFrameset(const DRect &);
00061 
00062     void initPage(const QValueVector<DRect> &,
00063                   const QValueList<QDomElement> &pictures);
00064     void endDump();
00065 
00066 public:
00067     uint pageIndex;
00068 
00069 private:
00070     enum FramesetType { Text, Picture };
00071     QDomElement createFrameset(FramesetType, const QString &name);
00072     QDomElement createFrame(FramesetType, const DRect &,
00073                             bool forceMainFrameset);
00074 
00075 private:
00076     KoFilterChain *_chain;
00077     QDomDocument   _document;
00078     uint           _imageIndex, _textIndex;
00079     QDomElement    _mainElement, _framesets, _pictures, _bookmarks, _paper;
00080     QValueVector<QDomElement> _textFramesets;
00081     DRect          _pageRect, _marginRect;
00082     const Options &_options;
00083 };
00084 
00085 } // namespace
00086 
00087 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys