kword

KWInsertTOCCommand.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@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 as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef contents_h
21#define contents_h
22
23class KWTextFrameSet;
24class KMacroCommand;
25class KoParagStyle;
26#include <KoRichText.h>
27
28// This command inserts a TOC at the beginning of a frameset, and is able to undo that.
29// The reason we don't use KWTextFrameSet's insert, applyStyle etc. is that it would
30// generate many many subcommands (resulting in much memory use).
31class KWInsertTOCCommand : public KoTextDocCommand
32{
33public:
34 // The parag is where the TOC should be inserted
35 KWInsertTOCCommand( KWTextFrameSet *fs, KoTextParag *parag );
36 KoTextCursor *execute( KoTextCursor *c );
37 KoTextCursor *unexecute( KoTextCursor *c );
38
39 // Helper method, public for KWTextFrameSet::insertTOC().
40 // Remove a toc based on the parag styles
41 static KoTextCursor * removeTOC( KWTextFrameSet *fs, KoTextCursor *cursor, KMacroCommand *macroCmd );
42
43protected:
44 // Find or create a toc style
45 static KoParagStyle * findOrCreateTOCStyle( KWTextFrameSet *fs, int depth );
46
47 int m_paragId;
48};
49
50
51
52#endif
Class: KWTextFrameSet Contains text (KoTextObject) and frames to display that text.