filters

ImportFormatting.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, 2002, 2004 Nicolas GOUTTE <goutte@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _IMPORT_FORMATTING_H
00021 #define _IMPORT_FORMATTING_H
00022 
00023 #include <qptrstack.h>
00024 #include <qstring.h>
00025 #include <qcolor.h>
00026 #include <qxml.h>
00027 #include <qdom.h>
00028 
00029 #include "ImportHelpers.h"
00030 
00031 // Tags in lower case (e.g. <c>) are AbiWord's ones.
00032 // Tags in upper case (e.g. <TEXT>) are KWord's ones.
00033 
00034 // Note: as we are not validating anything, we are quite tolerant about the file
00035 //   that we will read.
00036 
00052 enum StackItemElementType{
00053     ElementTypeUnknown  = 0,
00054     ElementTypeBottom,      
00055     ElementTypeIgnore,      
00056     ElementTypeEmpty,       
00057     ElementTypeSection,     
00058     ElementTypeParagraph,   
00059     ElementTypeContent,     
00060     ElementTypeRealData,    
00061     ElementTypeAnchor,      
00062     ElementTypeAnchorContent,
00063     ElementTypeIgnoreWord,  
00064     ElementTypeRealMetaData,
00065     ElementTypeFoot,        
00066     ElementTypeTable,       
00067     ElementTypeCell         
00068 };
00069 
00070 
00071 class StackItem
00072 {
00073 public:
00074     StackItem();
00075     ~StackItem();
00076 public:
00077     QString itemName;   
00078     StackItemElementType elementType;
00079     QDomElement m_frameset; 
00080     QDomElement stackElementParagraph; 
00081     QDomElement stackElementText; 
00082     QDomElement stackElementFormatsPlural; 
00083     QString     fontName; 
00084     int         fontSize;
00085     int         pos; 
00086     bool        italic;
00087     bool        bold;   
00088     bool        underline;
00089     bool        strikeout;
00090     QColor      fgColor;
00091     QColor      bgColor;
00092     int         textPosition; 
00093     QString     strTemp1; 
00098     QString     strTemp2; 
00108     QMemArray<double> m_doubleArray;
00109 };
00110 
00111 class StackItemStack : public QPtrStack<StackItem>
00112 {
00113 public:
00114         StackItemStack(void) { }
00115         virtual ~StackItemStack(void) { }
00116 };
00117 
00118 class StyleData;
00119 
00120 void PopulateProperties(StackItem* stackItem, const QString& strStyleProps,
00121     const QXmlAttributes& attributes, AbiPropsMap& abiPropsMap,
00122     const bool allowInit);
00123 void AddFormat(QDomElement& formatElementOut, StackItem* stackItem,
00124     QDomDocument& mainDocument);
00125 void AddLayout(const QString& strStyleName, QDomElement& layoutElement,
00126     StackItem* stackItem, QDomDocument& mainDocument,
00127     const AbiPropsMap& abiPropsMap, const int level, const bool isStyle);
00128 void AddStyle(QDomElement& styleElement, const QString& strStyleName,
00129     const StyleData& styleData, QDomDocument& mainDocument);
00130 
00131 
00132 #endif // _IMPORT_FORMATTING_H
KDE Home | KDE Accessibility Home | Description of Access Keys