/* This file is part of the KDE project Copyright (C) 2001, 2002, 2004 Nicolas GOUTTE This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _IMPORT_FORMATTING_H #define _IMPORT_FORMATTING_H #include #include #include #include #include #include "ImportHelpers.h" // Tags in lower case (e.g. ) are AbiWord's ones. // Tags in upper case (e.g. ) are KWord's ones. // Note: as we are not validating anything, we are quite tolerant about the file // that we will read. /** * States * * Tags that we do not care of: * \ (or \), \, \, \, \, \ * * Tags that we do not support (however KWord could): * \, \ * * Tags that we cannot support (lack of support in KWord): * N/A * * Properties that we do not or cannot support: * page-margin-footer, page-margin-header, lang, font-stretch, keep-with-next... */ enum StackItemElementType{ ElementTypeUnknown = 0, ElementTypeBottom, ///< Bottom of the stack ElementTypeIgnore, ///< Element is known but ignored ElementTypeEmpty, ///< Element is empty (\, \, \, \, \, \, \) ElementTypeSection, ///< \ ElementTypeParagraph, ///< \ ElementTypeContent, ///< \ (not child of \), also \ if it points to a bookmark ElementTypeRealData, ///< \ ElementTypeAnchor, ///< \ ElementTypeAnchorContent,///< \ when child of \ ElementTypeIgnoreWord, ///< \ ElementTypeRealMetaData,///< \ ElementTypeFoot, ///< \ ElementTypeTable, ///< \ ElementTypeCell ///< \ }; class StackItem { public: StackItem(); ~StackItem(); public: TQString itemName; ///< Name of the tag (only for error purposes) StackItemElementType elementType; TQDomElement m_frameset; ///< current \ TQDomElement stackElementParagraph; ///< \ TQDomElement stackElementText; ///< \ TQDomElement stackElementFormatsPlural; ///< \ TQString fontName; ///< font name but for \: name int fontSize; int pos; ///< Position bool italic; bool bold; ///< bold but for \: is base64 coded? bool underline; bool strikeout; TQColor fgColor; TQColor bgColor; int textPosition; ///< Normal (0), subscript(1), superscript (2) TQString strTemp1; /**< for \: mime type * for \: link reference * for \: key * for \: KWord's table name */ TQString strTemp2; /**< for \: collecting the data * for \: link name * for \: collecting the data (i.e. word to ignore) * for \: value of the meta data * for \: Number of the table (needed as I18N does not allow adding phrases) */ /** * for tables (\, \): defines the widths of the columns. * Be careful: we are using the shallow copy mechanism of TQt. Use TQMemArray::detach when needed to avoid modifying the parents */ TQMemArray m_doubleArray; }; class StackItemStack : public TQPtrStack { public: StackItemStack(void) { } virtual ~StackItemStack(void) { } }; class StyleData; void PopulateProperties(StackItem* stackItem, const TQString& strStyleProps, const TQXmlAttributes& attributes, AbiPropsMap& abiPropsMap, const bool allowInit); void AddFormat(TQDomElement& formatElementOut, StackItem* stackItem, TQDomDocument& mainDocument); void AddLayout(const TQString& strStyleName, TQDomElement& layoutElement, StackItem* stackItem, TQDomDocument& mainDocument, const AbiPropsMap& abiPropsMap, const int level, const bool isStyle); void AddStyle(TQDomElement& styleElement, const TQString& strStyleName, const StyleData& styleData, TQDomDocument& mainDocument); #endif // _IMPORT_FORMATTING_H