lib

KoStyleCollection.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001-2005 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 version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef kostyle_h
00020 #define kostyle_h
00021 
00022 #include <qdom.h>
00023 #include <qvaluevector.h>
00024 #include "KoParagStyle.h"
00025 #include "KoUserStyleCollection.h"
00026 
00027 class KoGenStyles;
00028 class KoParagStyle;
00029 class KoOasisContext;
00030 class KoSavingContext;
00031 
00032 struct KoStyleChangeDef {
00033     KoStyleChangeDef() {
00034         paragLayoutChanged = -1;
00035         formatChanged = -1;
00036     }
00037     KoStyleChangeDef( int parag, int format) {
00038         paragLayoutChanged = parag;
00039         formatChanged = format;
00040     };
00041     int paragLayoutChanged;
00042     int formatChanged;
00043 };
00044 typedef QMap<KoParagStyle *, KoStyleChangeDef> KoStyleChangeDefMap;
00045 
00047 class KOTEXT_EXPORT KoStyleCollection : public KoUserStyleCollection
00048 {
00049 public:
00050     KoStyleCollection();
00051     ~KoStyleCollection();
00052 
00053     //const QPtrList<KoParagStyle> & styleList() const { return m_styleList; }
00054 
00055     // compat method, TODO: remove
00056     QStringList translatedStyleNames() const { return displayNameList(); }
00057 
00062     KoParagStyle* addStyle( KoParagStyle* sty ) {
00063         return static_cast<KoParagStyle*>( KoUserStyleCollection::addStyle( sty ) );
00064     }
00065 
00070     KoParagStyle* findStyle( const QString & name ) const {
00071         return static_cast<KoParagStyle*>( KoUserStyleCollection::findStyle( name, QString::fromLatin1( "Standard" ) ) );
00072     }
00073 
00078     KoParagStyle* findStyleByDisplayName( const QString & name ) const {
00079         return static_cast<KoParagStyle*>( KoUserStyleCollection::findStyleByDisplayName( name ) );
00080     }
00081 
00085     KoParagStyle* styleAt( int i ) { return static_cast<KoParagStyle*>( m_styleList[i] ); }
00086 
00087 
00089     void importStyles( const KoStyleCollection& styleList );
00090 
00093     int loadOasisStyles( KoOasisContext& context );
00094 
00097     void saveOasis( KoGenStyles& styles, int styleType, KoSavingContext& context ) const;
00098 
00100     void saveOasisOutlineStyles( KoXmlWriter& writer ) const;
00101 
00103     QValueVector<KoParagStyle *> outlineStyles() const;
00104 
00106     KoParagStyle* outlineStyleForLevel( int level ) const;
00107 
00109     KoParagStyle* numberedStyleForLevel( int level ) const;
00110 
00115     KoParagStyle* defaultStyle() const;
00116 
00117 #ifndef NDEBUG
00118     void printDebug() const;
00119 #endif
00120 };
00121 
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys