ooutils.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
3 Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
4 Copyright (c) 2003 David Faure <faure@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef OOUTILS_H
23#define OOUTILS_H
24
25#include <tqstring.h>
26#include <KoFilterChain.h>
27class TQColor;
28class TQDomElement;
29class KoStyleStack;
30class TQDomDocument;
31class KZip;
32
33class ooNS {
34public:
35 static const char* const office;
36 static const char* const style;
37 static const char* const text;
38 static const char* const table;
39 static const char* const draw;
40 static const char* const presentation;
41 static const char* const fo;
42 static const char* const xlink;
43 static const char* const number;
44 static const char* const svg;
45 static const char* const dc;
46 static const char* const meta;
47 static const char* const config;
48};
49
50namespace OoUtils
51{
52 TQString expandWhitespace(const TQDomElement& tag);
53
54 bool parseBorder(const TQString & tag, double * width, int * style, TQColor * color);
55
57
58 // Convert fo:margin-left, fo:margin-right and fo:text-indent to <INDENTS>
59 void importIndents( TQDomElement& parentElement, const KoStyleStack& styleStack );
60
61 // Convert fo:line-height, style:line-height-at-least and style:line-spacing to <LINESPACING>
62 void importLineSpacing( TQDomElement& parentElement, const KoStyleStack& styleStack );
63
64 // Convert fo:margin-top and fo:margin-bottom to <OFFSETS>
65 void importTopBottomMargin( TQDomElement& parentElement, const KoStyleStack& styleStack );
66
67 // Convert style:tab-stops to <TABULATORS>
68 void importTabulators( TQDomElement& parentElement, const KoStyleStack& styleStack );
69
70 // Convert fo:border* to <*BORDER>
71 void importBorders( TQDomElement& parentElement, const KoStyleStack& styleStack );
72
74
75 // From style:text-underline to kword/kpresenter's underline/underlinestyleline
76 void importUnderline( const TQString& text_underline, TQString& underline, TQString& styleline );
77
78 // From style:text-position (for subscript/superscript)
79 // to kword/kpresenter's value/relativetextsize
80 void importTextPosition( const TQString& text_position, TQString& value, TQString& relativetextsize );
81
82 void createDocumentInfo(TQDomDocument &_meta, TQDomDocument & docinfo);
83 KoFilter::ConversionStatus loadAndParse(const TQString& filename, TQDomDocument& doc, KZip * m_zip);
84 KoFilter::ConversionStatus loadAndParse(const TQString& filename, TQDomDocument& doc, KoStore *m_store );
85
87 KoFilter::ConversionStatus loadThumbnail( TQImage& thumbnail, KZip * m_zip );
88
89 // Internal
90 KoFilter::ConversionStatus loadAndParse(TQIODevice* io, TQDomDocument& doc, const TQString & fileName);
91}
92
93#endif /* OOUTILS_H */