00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KOOASISCONTEXT_H
00021 #define KOOASISCONTEXT_H
00022
00023 #include <KoOasisLoadingContext.h>
00024
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
00037
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
00101
00102
00103
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 ) {}
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
00167 bool hasColumns() const { return m_hasColumns; }
00168
00169
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