F:/KPlato/koffice/libs/kotext/KoOasisContext.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2004-2006 David Faure <faure@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 KOOASISCONTEXT_H
00021 #define KOOASISCONTEXT_H
00022 
00023 #include <KoOasisLoadingContext.h>
00024 //Added by qt3to4:
00025 #include <Q3ValueList>
00026 
00027 class KoVariableSettings;
00028 class KoTextParag;
00029 class KoParagStyle;
00030 class KoGenStyles;
00031 class KoVariableCollection;
00032 
00033 #include "KoListStyleStack.h"
00034 #include "KoTextBookmark.h"
00035 
00036 // ####### TODO rename to KoTextOasisLoadingContext (wow that's long).
00037 // ####### maybe KoTextLoadingContext?
00038 
00047 class KOTEXT_EXPORT KoOasisContext : public KoOasisLoadingContext
00048 {
00049 public:
00059     KoOasisContext( KoDocument* doc, KoVariableCollection& varColl,
00060                     KoOasisStyles& styles, KoStore* store );
00061     ~KoOasisContext();
00062 
00063     KoVariableCollection& variableCollection() { return m_varColl; }
00064 
00066 
00067     KoListStyleStack& listStyleStack() { return m_listStyleStack; }
00068     QString currentListStyleName() const { return m_currentListStyleName; }
00069     void setCurrentListStyleName( const QString& s ) { m_currentListStyleName = s; }
00070 
00073     bool pushListLevelStyle( const QString& listStyleName, int level );
00075     bool pushOutlineListLevelStyle( int level );
00076 
00078     void setCursorPosition( KoTextParag* cursorTextParagraph,
00079                             int cursorTextIndex );
00080 
00081     KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00082     int cursorTextIndex() const { return m_cursorTextIndex; }
00083 
00084 private:
00086     bool pushListLevelStyle( const QString& listStyleName, const QDomElement& fullListStyle, int level );
00087 
00088 private:
00089     KoListStyleStack m_listStyleStack;
00090     QString m_currentListStyleName;
00091     KoVariableCollection& m_varColl;
00092 
00093     KoTextParag* m_cursorTextParagraph;
00094     int m_cursorTextIndex;
00095 
00096     class Private;
00097     Private *d;
00098 };
00099 
00100 // TODO extract non-text base class for kofficecore, see KoOasisLoadingContext
00101 
00102 // ####### TODO rename to KoTextOasisSavingContext (wow that's long).
00103 // ####### maybe KoTextSavingContext?
00104 
00113 class KOTEXT_EXPORT KoSavingContext
00114 {
00115 public:
00116     enum SavingMode { Store, Flat };
00117 
00123     KoSavingContext( KoGenStyles& mainStyles, KoVariableSettings* settings = 0, bool hasColumns = false, SavingMode savingMode = Store );
00124 
00125     ~KoSavingContext();
00126 
00127 
00128     KoGenStyles& mainStyles() { return m_mainStyles; }
00129 
00131     SavingMode savingMode() const { return m_savingMode; }
00132 
00134     void setCursorPosition( KoTextParag* cursorTextParagraph,
00135                             int cursorTextIndex );
00136 
00137     KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00138     int cursorTextIndex() const { return m_cursorTextIndex; }
00139 
00142     struct BookmarkPosition {
00143         BookmarkPosition() : name(), pos( -1 ), startEqualsEnd( false ) {} // for QValueList
00144         BookmarkPosition( const QString& nm, int p, bool simple )
00145             : name( nm ), pos( p ), startEqualsEnd( simple ) {}
00146         QString name;
00147         int pos;
00148         bool startEqualsEnd;
00149         bool operator<( const BookmarkPosition& rhs ) const {
00150             return pos < rhs.pos;
00151         }
00152     };
00153     typedef Q3ValueList<BookmarkPosition> BookmarkPositions;
00154     void setBookmarkPositions( const BookmarkPositions& bkStarts,
00155                                const BookmarkPositions& bkEnds ) {
00156         m_bookmarkStarts = bkStarts;
00157         m_bookmarkEnds = bkEnds;
00158     }
00159     const BookmarkPositions& bookmarkStarts() const { return m_bookmarkStarts; }
00160     const BookmarkPositions& bookmarkEnds() const { return m_bookmarkEnds; }
00161 
00162     void addFontFace( const QString& fontName );
00163     typedef QMap<QString, bool> FontFaces;
00164     void writeFontFaces( KoXmlWriter& writer );
00165 
00166     // See KoParagLayout::saveOasis
00167     bool hasColumns() const { return m_hasColumns; }
00168 
00169     // See KoTextParag::saveOasis
00170     KoVariableSettings* variableSettings() const { return m_variableSettings; }
00171 
00172 private:
00173     KoGenStyles& m_mainStyles;
00174     SavingMode m_savingMode;
00175 
00176     BookmarkPositions m_bookmarkStarts, m_bookmarkEnds;
00177 
00178     KoTextParag* m_cursorTextParagraph;
00179     int m_cursorTextIndex;
00180     FontFaces m_fontFaces;
00181     KoVariableSettings* m_variableSettings;
00182     bool m_hasColumns;
00183 
00184     class Private;
00185     Private *d;
00186 };
00187 
00188 #endif /* KOOASISCONTEXT_H */

Généré le Wed Nov 22 23:41:08 2006 pour KPlato par  doxygen 1.5.1-p1