lib

KoStyleCollection.h
1/* This file is part of the KDE project
2 Copyright (C) 2001-2005 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef kostyle_h
20#define kostyle_h
21
22#include <tqdom.h>
23#include <tqvaluevector.h>
24#include "KoParagStyle.h"
25#include "KoUserStyleCollection.h"
26
27class KoGenStyles;
28class KoParagStyle;
29class KoOasisContext;
30class KoSavingContext;
31
32struct KoStyleChangeDef {
33 KoStyleChangeDef() {
34 paragLayoutChanged = -1;
35 formatChanged = -1;
36 }
37 KoStyleChangeDef( int parag, int format) {
38 paragLayoutChanged = parag;
39 formatChanged = format;
40 };
41 int paragLayoutChanged;
42 int formatChanged;
43};
44typedef TQMap<KoParagStyle *, KoStyleChangeDef> KoStyleChangeDefMap;
45
47class KOTEXT_EXPORT KoStyleCollection : public KoUserStyleCollection
48{
49public:
50 KoStyleCollection();
51 ~KoStyleCollection();
52
53 //const TQPtrList<KoParagStyle> & styleList() const { return m_styleList; }
54
55 // compat method, TODO: remove
56 TQStringList translatedStyleNames() const { return displayNameList(); }
57
63 return static_cast<KoParagStyle*>( KoUserStyleCollection::addStyle( sty ) );
64 }
65
70 KoParagStyle* findStyle( const TQString & name ) const {
71 return static_cast<KoParagStyle*>( KoUserStyleCollection::findStyle( name, TQString::fromLatin1( "Standard" ) ) );
72 }
73
78 KoParagStyle* findStyleByDisplayName( const TQString & name ) const {
79 return static_cast<KoParagStyle*>( KoUserStyleCollection::findStyleByDisplayName( name ) );
80 }
81
85 KoParagStyle* styleAt( int i ) { return static_cast<KoParagStyle*>( m_styleList[i] ); }
86
87
89 void importStyles( const KoStyleCollection& styleList );
90
93 int loadOasisStyles( KoOasisContext& context );
94
97 void saveOasis( KoGenStyles& styles, int styleType, KoSavingContext& context ) const;
98
100 void saveOasisOutlineStyles( KoXmlWriter& writer ) const;
101
103 TQValueVector<KoParagStyle *> outlineStyles() const;
104
106 KoParagStyle* outlineStyleForLevel( int level ) const;
107
109 KoParagStyle* numberedStyleForLevel( int level ) const;
110
115 KoParagStyle* defaultStyle() const;
116
117#ifndef NDEBUG
118 void printDebug() const;
119#endif
120};
121
122#endif
Repository of styles used during saving of OASIS/OOo file.
Definition KoGenStyles.h:60
Used during loading of Oasis format (and discarded at the end of the loading).
A paragraph style is a combination of a character style and paragraph-layout attributes,...
Used during saving to Oasis format (and discarded at the end of the saving).
TODO rename to KoParagStyleCollection - or should char styles be part of it too?
KoParagStyle * findStyleByDisplayName(const TQString &name) const
Find style based on the display name displayName.
KoParagStyle * addStyle(KoParagStyle *sty)
See KoUserStyleCollection::addStyle.
KoParagStyle * styleAt(int i)
Return style number i.
KoParagStyle * findStyle(const TQString &name) const
Find style based on the internal name name.
KoUserStyle * findStyleByDisplayName(const TQString &displayName) const
Find style based on the display name displayName.
TQStringList displayNameList() const
Return the list composed of the display-name of each style in the collection.
KoUserStyle * findStyle(const TQString &name, const TQString &defaultStyleName) const
Find style based on the internal name name.
KoUserStyle * addStyle(KoUserStyle *sty)
Try adding sty to the collection.
KoUserStyleCollection(const TQString &prefix)
Constructor.
A class for writing out XML (to any TQIODevice), with a special attention on performance.
Definition KoXmlWriter.h:37