lib
KoOasisContext.h00001
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 class KoVariableSettings;
00026 class KoTextParag;
00027 class KoParagStyle;
00028 class KoGenStyles;
00029 class KoVariableCollection;
00030
00031 #include "KoListStyleStack.h"
00032 #include "KoTextBookmark.h"
00033
00034
00035
00036
00045 class KOTEXT_EXPORT KoOasisContext : public KoOasisLoadingContext
00046 {
00047 public:
00057 KoOasisContext( KoDocument* doc, KoVariableCollection& varColl,
00058 KoOasisStyles& styles, KoStore* store );
00059 ~KoOasisContext();
00060
00061 KoVariableCollection& variableCollection() { return m_varColl; }
00062
00064
00065 KoListStyleStack& listStyleStack() { return m_listStyleStack; }
00066 QString currentListStyleName() const { return m_currentListStyleName; }
00067 void setCurrentListStyleName( const QString& s ) { m_currentListStyleName = s; }
00068
00071 bool pushListLevelStyle( const QString& listStyleName, int level );
00073 bool pushOutlineListLevelStyle( int level );
00074
00076 void setCursorPosition( KoTextParag* cursorTextParagraph,
00077 int cursorTextIndex );
00078
00079 KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00080 int cursorTextIndex() const { return m_cursorTextIndex; }
00081
00082 private:
00084 bool pushListLevelStyle( const QString& listStyleName, const QDomElement& fullListStyle, int level );
00085
00086 private:
00087 KoListStyleStack m_listStyleStack;
00088 QString m_currentListStyleName;
00089 KoVariableCollection& m_varColl;
00090
00091 KoTextParag* m_cursorTextParagraph;
00092 int m_cursorTextIndex;
00093
00094 class Private;
00095 Private *d;
00096 };
00097
00098
00099
00100
00101
00102
00111 class KOTEXT_EXPORT KoSavingContext
00112 {
00113 public:
00114 enum SavingMode { Store, Flat };
00115
00121 KoSavingContext( KoGenStyles& mainStyles, KoVariableSettings* settings = 0, bool hasColumns = false, SavingMode savingMode = Store );
00122
00123 ~KoSavingContext();
00124
00125
00126 KoGenStyles& mainStyles() { return m_mainStyles; }
00127
00129 SavingMode savingMode() const { return m_savingMode; }
00130
00132 void setCursorPosition( KoTextParag* cursorTextParagraph,
00133 int cursorTextIndex );
00134
00135 KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00136 int cursorTextIndex() const { return m_cursorTextIndex; }
00137
00140 struct BookmarkPosition {
00141 BookmarkPosition() : name(), pos( -1 ), startEqualsEnd( false ) {}
00142 BookmarkPosition( const QString& nm, int p, bool simple )
00143 : name( nm ), pos( p ), startEqualsEnd( simple ) {}
00144 QString name;
00145 int pos;
00146 bool startEqualsEnd;
00147 bool operator<( BookmarkPosition& rhs ) const {
00148 return pos < rhs.pos;
00149 }
00150 };
00151 typedef QValueList<BookmarkPosition> BookmarkPositions;
00152 void setBookmarkPositions( const BookmarkPositions& bkStarts,
00153 const BookmarkPositions& bkEnds ) {
00154 m_bookmarkStarts = bkStarts;
00155 m_bookmarkEnds = bkEnds;
00156 }
00157 const BookmarkPositions& bookmarkStarts() const { return m_bookmarkStarts; }
00158 const BookmarkPositions& bookmarkEnds() const { return m_bookmarkEnds; }
00159
00160 void addFontFace( const QString& fontName );
00161 typedef QMap<QString, bool> FontFaces;
00162 void writeFontFaces( KoXmlWriter& writer );
00163
00164
00165 bool hasColumns() const { return m_hasColumns; }
00166
00167
00168 KoVariableSettings* variableSettings() const { return m_variableSettings; }
00169
00170 private:
00171 KoGenStyles& m_mainStyles;
00172 SavingMode m_savingMode;
00173
00174 BookmarkPositions m_bookmarkStarts, m_bookmarkEnds;
00175
00176 KoTextParag* m_cursorTextParagraph;
00177 int m_cursorTextIndex;
00178 FontFaces m_fontFaces;
00179 KoVariableSettings* m_variableSettings;
00180 bool m_hasColumns;
00181
00182 class Private;
00183 Private *d;
00184 };
00185
00186 #endif
|