File indexing completed on 2025-07-13 10:51:46
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2002 Laurent Montel <lmontel@mandrakesoft.com> 0003 SPDX-FileCopyrightText: 2003 Lukas Tinkl <lukas@kde.org> 0004 SPDX-FileCopyrightText: 2003 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef OOUTILS_H 0010 #define OOUTILS_H 0011 0012 #include <QString> 0013 #include <KoFilter.h> 0014 #include <KoXmlReader.h> 0015 class QColor; 0016 class QDomElement; 0017 class KoStyleStack; 0018 class QDomDocument; 0019 class KZip; 0020 class KoStore; 0021 class ooNS 0022 { 0023 public: 0024 static const char office[]; 0025 static const char style[]; 0026 static const char text[]; 0027 static const char table[]; 0028 static const char draw[]; 0029 static const char presentation[]; 0030 static const char fo[]; 0031 static const char xlink[]; 0032 static const char number[]; 0033 static const char svg[]; 0034 static const char dc[]; 0035 static const char meta[]; 0036 static const char config[]; 0037 }; 0038 0039 namespace OoUtils 0040 { 0041 QString expandWhitespace(const KoXmlElement& tag); 0042 0043 bool parseBorder(const QString & tag, double * width, int * style, QColor * color); 0044 0045 ///////// Paragraph properties ///////// 0046 0047 // Convert fo:margin-left, fo:margin-right and fo:text-indent to <INDENTS> 0048 void importIndents(QDomElement& parentElement, const KoStyleStack& styleStack); 0049 0050 // Convert fo:line-height, style:line-height-at-least and style:line-spacing to <LINESPACING> 0051 void importLineSpacing(QDomElement& parentElement, const KoStyleStack& styleStack); 0052 0053 // Convert fo:margin-top and fo:margin-bottom to <OFFSETS> 0054 void importTopBottomMargin(QDomElement& parentElement, const KoStyleStack& styleStack); 0055 0056 // Convert style:tab-stops to <TABULATORS> 0057 void importTabulators(QDomElement& parentElement, const KoStyleStack& styleStack); 0058 0059 // Convert fo:border* to <*BORDER> 0060 void importBorders(QDomElement& parentElement, const KoStyleStack& styleStack); 0061 0062 /////////// Text properties /////////// 0063 0064 // From style:text-underline to Words/Stage's underline/underlinestyleline 0065 void importUnderline(const QString& text_underline, QString& underline, QString& styleline); 0066 0067 // From style:text-position (for subscript/superscript) 0068 // to Words/Stage's value/relativetextsize 0069 void importTextPosition(const QString& text_position, QString& value, QString& relativetextsize); 0070 0071 void createDocumentInfo(KoXmlDocument &_meta, QDomDocument & docinfo); 0072 KoFilter::ConversionStatus loadAndParse(const QString& filename, KoXmlDocument& doc, KZip* zip); 0073 KoFilter::ConversionStatus loadAndParse(const QString& filename, KoXmlDocument& doc, KoStore* store); 0074 0075 /// Load an OASIS thumbnail 0076 KoFilter::ConversionStatus loadThumbnail(QImage& thumbnail, KZip* zip); 0077 0078 // Internal 0079 KoFilter::ConversionStatus loadAndParse(QIODevice* io, KoXmlDocument& doc, const QString & fileName); 0080 } 0081 0082 #endif /* OOUTILS_H */