lib Library API Documentation

kooasiscontext.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef KOOASISCONTEXT_H
00021 #define KOOASISCONTEXT_H
00022 
00023 class KoVariableSettings;
00024 class KoXmlWriter;
00025 class KoTextParag;
00026 class KoParagStyle;
00027 class KoGenStyles;
00028 class QDomElement;
00029 class KoDocument;
00030 class KoOasisStyles;
00031 class KoPictureCollection;
00032 class KoStore;
00033 class KoVariableCollection;
00034 
00035 #include <koStyleStack.h>
00036 #include "koliststylestack.h"
00037 #include <qmap.h>
00038 #include <koffice_export.h>
00039 #include <qstringlist.h>
00040 
00050 class KOTEXT_EXPORT KoOasisContext
00051 {
00052 public:
00062     KoOasisContext( KoDocument* doc, KoVariableCollection& varColl,
00063                     KoOasisStyles& styles, KoStore* store );
00064     ~KoOasisContext();
00065 
00066     KoDocument* koDocument() { return m_doc; }
00067     KoVariableCollection& variableCollection() { return m_varColl; }
00068     KoStore* store() { return m_store; }
00069 
00070     KoOasisStyles& oasisStyles() { return m_styles; }
00071     KoStyleStack& styleStack() { return m_styleStack; }
00072 
00073     const QDomDocument& manifestDocument() const { return m_manifestDoc; }
00074 
00075     void fillStyleStack( const QDomElement& object, const char* nsURI, const char* attrName );
00076     void addStyles( const QDomElement* style );
00077 
00079 
00080     KoListStyleStack& listStyleStack() { return m_listStyleStack; }
00081     QString currentListStyleName() const { return m_currentListStyleName; }
00082     void setCurrentListStyleName( const QString& s ) { m_currentListStyleName = s; }
00083 
00086     bool pushListLevelStyle( const QString& listStyleName, int level );
00088     bool pushOutlineListLevelStyle( int level );
00089 
00091     void setCursorPosition( KoTextParag* cursorTextParagraph,
00092                             int cursorTextIndex );
00093 
00094     KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00095     int cursorTextIndex() const { return m_cursorTextIndex; }
00096 
00097 private:
00099     bool pushListLevelStyle( const QString& listStyleName, const QDomElement& fullListStyle, int level );
00100 
00101 private:
00102     KoDocument* m_doc;
00103     KoStore* m_store;
00104     KoVariableCollection& m_varColl;
00105     KoOasisStyles& m_styles;
00106     KoStyleStack m_styleStack;
00107 
00108     KoListStyleStack m_listStyleStack;
00109     QString m_currentListStyleName;
00110 
00111     KoTextParag* m_cursorTextParagraph;
00112     int m_cursorTextIndex;
00113 
00114     QDomDocument m_manifestDoc;
00115 
00116     class Private;
00117     Private *d;
00118 };
00119 
00128 class KOTEXT_EXPORT KoSavingContext
00129 {
00130 public:
00131     enum SavingMode { Store, Flat };
00132 
00138     KoSavingContext( KoGenStyles& mainStyles, KoVariableSettings* settings = 0, bool hasColumns = false, SavingMode savingMode = Store );
00139 
00140     ~KoSavingContext();
00141 
00142 
00143     KoGenStyles& mainStyles() { return m_mainStyles; }
00144 
00146     SavingMode savingMode() const { return m_savingMode; }
00147 
00148     typedef QMap<KoParagStyle*, QString> StyleNameMap;
00149 
00152     void setStyleNameMap( const StyleNameMap& map ) { m_styleNameMap = map; }
00153 
00155     QString styleAutoName( KoParagStyle* style ) const {
00156         StyleNameMap::const_iterator it = m_styleNameMap.find( style );
00157         if ( it != m_styleNameMap.end() )
00158             return *it;
00159         return QString::null;
00160     }
00161 
00163     void setCursorPosition( KoTextParag* cursorTextParagraph,
00164                             int cursorTextIndex );
00165 
00166     KoTextParag* cursorTextParagraph() const { return m_cursorTextParagraph; }
00167     int cursorTextIndex() const { return m_cursorTextIndex; }
00168 
00169     void addFontFace( const QString& fontName );
00170     typedef QMap<QString, bool> FontFaces;
00171     void writeFontFaces( KoXmlWriter& writer );
00172 
00173     // See KoParagLayout::saveOasis
00174     bool hasColumns() const { return m_hasColumns; }
00175 
00176     // See KoTextParag::saveOasis
00177     KoVariableSettings* variableSettings() const { return m_variableSettings; }
00178 
00179 private:
00180     KoGenStyles& m_mainStyles;
00181     StyleNameMap m_styleNameMap;
00182     SavingMode m_savingMode;
00183 
00184     KoTextParag* m_cursorTextParagraph;
00185     int m_cursorTextIndex;
00186     FontFaces m_fontFaces;
00187     KoVariableSettings* m_variableSettings;
00188     bool m_hasColumns;
00189 
00190     class Private;
00191     Private *d;
00192 };
00193 
00194 #endif /* KOOASISCONTEXT_H */
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:02 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003