~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kword/abiword/ImportFormatting.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $Header: /home/kde/koffice/filters/kword/abiword/ImportFormatting.h,v 1.19 2002/12/27 22:36:09 goutte Exp $
 
2
 
 
3
/* This file is part of the KDE project
 
4
   Copyright (C) 2001, 2002 Nicolas GOUTTE <goutte@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., 59 Temple Place - Suite 330,
 
19
   Boston, MA 02111-1307, USA.
 
20
*/
 
21
 
 
22
#ifndef _IMPORT_FORMATTING_H
 
23
#define _IMPORT_FORMATTING_H
 
24
 
 
25
#include <qptrstack.h>
 
26
#include <qstring.h>
 
27
#include <qcolor.h>
 
28
#include <qxml.h>
 
29
#include <qdom.h>
 
30
 
 
31
#include "ImportHelpers.h"
 
32
 
 
33
// Tags in lower case (e.g. <c>) are AbiWord's ones.
 
34
// Tags in upper case (e.g. <TEXT>) are KWord's ones.
 
35
 
 
36
// Note: as we are not validating anything, we are quite tolerant about the file
 
37
//   that we will read.
 
38
 
 
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>
 
55
};
 
56
 
 
57
// Tags that we do not care of:
 
58
//  <abiword> (or <awml>), <data>, <styles>, <ignorewords>, <lists>, <metadata>
 
59
//
 
60
// Tags that we do not support (however KWord could):
 
61
//  <bookmark>, <l>, <table>, <cell>
 
62
//
 
63
// Tags that we cannot support (lack of support in KWord):
 
64
//  N/A
 
65
//
 
66
// Properties that we do not or cannot support:
 
67
//  page-margin-footer, page-margin-header, lang, font-stretch, keep-with-next...
 
68
 
 
69
 
 
70
class StackItem
 
71
{
 
72
public:
 
73
    StackItem();
 
74
    ~StackItem();
 
75
public:
 
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
 
83
    int         fontSize;
 
84
    int         pos; //Position
 
85
    bool        italic;
 
86
    bool        bold;   // bold but for <d>: is base64 coded?
 
87
    bool        underline;
 
88
    bool        strikeout;
 
89
    QColor      fgColor;
 
90
    QColor      bgColor;
 
91
    int         textPosition; //Normal (0), subscript(1), superscript (2)
 
92
    QString     strTemp1; // for <d>: mime type
 
93
                          // for <a>: link reference
 
94
                          // for <m>: key
 
95
                          // for <table>: KWord's table name
 
96
    QString     strTemp2; // for <d>: collecting the data
 
97
                          // for <a>: link name
 
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)
 
101
};
 
102
 
 
103
class StackItemStack : public QPtrStack<StackItem>
 
104
{
 
105
public:
 
106
        StackItemStack(void) { }
 
107
        virtual ~StackItemStack(void) { }
 
108
};
 
109
 
 
110
class StyleData;
 
111
 
 
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);
 
122
 
 
123
 
 
124
#endif // _IMPORT_FORMATTING_H