ImportFormatting.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2004 Nicolas GOUTTE <goutte@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _IMPORT_FORMATTING_H
21#define _IMPORT_FORMATTING_H
22
23#include <tqptrstack.h>
24#include <tqstring.h>
25#include <tqcolor.h>
26#include <tqxml.h>
27#include <tqdom.h>
28
29#include "ImportHelpers.h"
30
31// Tags in lower case (e.g. <c>) are AbiWord's ones.
32// Tags in upper case (e.g. <TEXT>) are KWord's ones.
33
34// Note: as we are not validating anything, we are quite tolerant about the file
35// that we will read.
36
52enum StackItemElementType{
53 ElementTypeUnknown = 0,
54 ElementTypeBottom,
55 ElementTypeIgnore,
56 ElementTypeEmpty,
57 ElementTypeSection,
58 ElementTypeParagraph,
59 ElementTypeContent,
60 ElementTypeRealData,
61 ElementTypeAnchor,
62 ElementTypeAnchorContent,
63 ElementTypeIgnoreWord,
64 ElementTypeRealMetaData,
65 ElementTypeFoot,
66 ElementTypeTable,
67 ElementTypeCell
68};
69
70
71class StackItem
72{
73public:
74 StackItem();
75 ~StackItem();
76public:
77 TQString itemName;
78 StackItemElementType elementType;
79 TQDomElement m_frameset;
80 TQDomElement stackElementParagraph;
81 TQDomElement stackElementText;
82 TQDomElement stackElementFormatsPlural;
83 TQString fontName;
84 int fontSize;
85 int pos;
86 bool italic;
87 bool bold;
88 bool underline;
89 bool strikeout;
90 TQColor fgColor;
91 TQColor bgColor;
92 int textPosition;
93 TQString strTemp1;
98 TQString strTemp2;
108 TQMemArray<double> m_doubleArray;
109};
110
111class StackItemStack : public TQPtrStack<StackItem>
112{
113public:
114 StackItemStack(void) { }
115 virtual ~StackItemStack(void) { }
116};
117
118class StyleData;
119
120void PopulateProperties(StackItem* stackItem, const TQString& strStyleProps,
121 const TQXmlAttributes& attributes, AbiPropsMap& abiPropsMap,
122 const bool allowInit);
123void AddFormat(TQDomElement& formatElementOut, StackItem* stackItem,
124 TQDomDocument& mainDocument);
125void AddLayout(const TQString& strStyleName, TQDomElement& layoutElement,
126 StackItem* stackItem, TQDomDocument& mainDocument,
127 const AbiPropsMap& abiPropsMap, const int level, const bool isStyle);
128void AddStyle(TQDomElement& styleElement, const TQString& strStyleName,
129 const StyleData& styleData, TQDomDocument& mainDocument);
130
131
132#endif // _IMPORT_FORMATTING_H
Helpers for the AbiWord import filter.