filters

ooutils.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
00003    Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
00004    Copyright (c) 2003 David Faure <faure@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef OOUTILS_H
00023 #define OOUTILS_H
00024 
00025 #include <qstring.h>
00026 #include <KoFilterChain.h>
00027 class QColor;
00028 class QDomElement;
00029 class KoStyleStack;
00030 class QDomDocument;
00031 class KZip;
00032 
00033 class ooNS {
00034 public:
00035     static const char* const office;
00036     static const char* const style;
00037     static const char* const text;
00038     static const char* const table;
00039     static const char* const draw;
00040     static const char* const presentation;
00041     static const char* const fo;
00042     static const char* const xlink;
00043     static const char* const number;
00044     static const char* const svg;
00045     static const char* const dc;
00046     static const char* const meta;
00047     static const char* const config;
00048 };
00049 
00050 namespace OoUtils
00051 {
00052     QString expandWhitespace(const QDomElement& tag);
00053 
00054     bool parseBorder(const QString & tag, double * width, int * style, QColor * color);
00055 
00057 
00058     // Convert fo:margin-left, fo:margin-right and fo:text-indent to <INDENTS>
00059     void importIndents( QDomElement& parentElement, const KoStyleStack& styleStack );
00060 
00061     // Convert fo:line-height, style:line-height-at-least and style:line-spacing to <LINESPACING>
00062     void importLineSpacing( QDomElement& parentElement, const KoStyleStack& styleStack );
00063 
00064     // Convert fo:margin-top and fo:margin-bottom to <OFFSETS>
00065     void importTopBottomMargin( QDomElement& parentElement, const KoStyleStack& styleStack );
00066 
00067     // Convert style:tab-stops to <TABULATORS>
00068     void importTabulators( QDomElement& parentElement, const KoStyleStack& styleStack );
00069 
00070     // Convert fo:border* to <*BORDER>
00071     void importBorders( QDomElement& parentElement, const KoStyleStack& styleStack );
00072 
00074 
00075     // From style:text-underline to kword/kpresenter's underline/underlinestyleline
00076     void importUnderline( const QString& text_underline, QString& underline, QString& styleline );
00077 
00078     // From style:text-position (for subscript/superscript)
00079     // to kword/kpresenter's value/relativetextsize
00080     void importTextPosition( const QString& text_position, QString& value, QString& relativetextsize );
00081 
00082     void createDocumentInfo(QDomDocument &_meta, QDomDocument & docinfo);
00083     KoFilter::ConversionStatus loadAndParse(const QString& filename, QDomDocument& doc, KZip * m_zip);
00084     KoFilter::ConversionStatus loadAndParse(const QString& filename, QDomDocument& doc, KoStore *m_store );
00085 
00087     KoFilter::ConversionStatus loadThumbnail( QImage& thumbnail, KZip * m_zip );
00088 
00089     // Internal
00090     KoFilter::ConversionStatus loadAndParse(QIODevice* io, QDomDocument& doc, const QString & fileName);
00091 }
00092 
00093 #endif /* OOUTILS_H */
KDE Home | KDE Accessibility Home | Description of Access Keys