1
// $Header: /home/kde/koffice/filters/kword/abiword/ImportFormatting.h,v 1.19 2002/12/27 22:36:09 goutte Exp $
3
/* This file is part of the KDE project
4
Copyright (C) 2001, 2002 Nicolas GOUTTE <goutte@kde.org>
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.
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.
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., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
22
#ifndef _IMPORT_FORMATTING_H
23
#define _IMPORT_FORMATTING_H
25
#include <qptrstack.h>
31
#include "ImportHelpers.h"
33
// Tags in lower case (e.g. <c>) are AbiWord's ones.
34
// Tags in upper case (e.g. <TEXT>) are KWord's ones.
36
// Note: as we are not validating anything, we are quite tolerant about the file
39
enum StackItemElementType{
40
ElementTypeUnknown = 0,
41
ElementTypeBottom, // Bottom of the stack
42
ElementTypeIgnore, // Element is known but ignored
43
ElementTypeEmpty, // Element is empty (<pagesize>, <s>, <image>, <field>, <br>, <cbr>, <pbr>)
44
ElementTypeSection, // <section>
45
ElementTypeParagraph, // <p>
46
ElementTypeContent, // <c> (not child of <a>), also <a> if it points to a bookmark
47
ElementTypeRealData, // <d>
48
ElementTypeAnchor, // <a>
49
ElementTypeAnchorContent,// <c> when child of <a>
50
ElementTypeIgnoreWord, // <iw>
51
ElementTypeRealMetaData,// <m>
52
ElementTypeFoot, // <foot>
53
ElementTypeTable, // <table>
54
ElementTypeCell // <cell>
57
// Tags that we do not care of:
58
// <abiword> (or <awml>), <data>, <styles>, <ignorewords>, <lists>, <metadata>
60
// Tags that we do not support (however KWord could):
61
// <bookmark>, <l>, <table>, <cell>
63
// Tags that we cannot support (lack of support in KWord):
66
// Properties that we do not or cannot support:
67
// page-margin-footer, page-margin-header, lang, font-stretch, keep-with-next...
76
QString itemName; // Name of the tag (only for error purposes)
77
StackItemElementType elementType;
78
QDomElement m_frameset; // current <FRAMESET>
79
QDomElement stackElementParagraph; // <PARAGRAPH>
80
QDomElement stackElementText; // <TEXT>
81
QDomElement stackElementFormatsPlural; // <FORMATS>
82
QString fontName; // font name but for <d>: name
86
bool bold; // bold but for <d>: is base64 coded?
91
int textPosition; //Normal (0), subscript(1), superscript (2)
92
QString strTemp1; // for <d>: mime type
93
// for <a>: link reference
95
// for <table>: KWord's table name
96
QString strTemp2; // for <d>: collecting the data
98
// for <iw>: collecting the data (i.e. word to ignore)
99
// for <m>: value of the meta data
100
// for <table>: Number of the table (needed as I18N does not allow adding phrases)
103
class StackItemStack : public QPtrStack<StackItem>
106
StackItemStack(void) { }
107
virtual ~StackItemStack(void) { }
112
void PopulateProperties(StackItem* stackItem, const QString& strStyleProps,
113
const QXmlAttributes& attributes, AbiPropsMap& abiPropsMap,
114
const bool allowInit);
115
void AddFormat(QDomElement& formatElementOut, StackItem* stackItem,
116
QDomDocument& mainDocument);
117
void AddLayout(const QString& strStyleName, QDomElement& layoutElement,
118
StackItem* stackItem, QDomDocument& mainDocument,
119
const AbiPropsMap& abiPropsMap, const int level, const bool isStyle);
120
void AddStyle(QDomElement& styleElement, const QString& strStyleName,
121
const StyleData& styleData, QDomDocument& mainDocument);
124
#endif // _IMPORT_FORMATTING_H