kword

KWInsertTOCCommand.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef contents_h
00021 #define contents_h
00022 
00023 class KWTextFrameSet;
00024 class KMacroCommand;
00025 class KoParagStyle;
00026 #include <KoRichText.h>
00027 
00028 // This command inserts a TOC at the beginning of a frameset, and is able to undo that.
00029 // The reason we don't use KWTextFrameSet's insert, applyStyle etc. is that it would
00030 // generate many many subcommands (resulting in much memory use).
00031 class KWInsertTOCCommand : public KoTextDocCommand
00032 {
00033 public:
00034     // The parag is where the TOC should be inserted
00035     KWInsertTOCCommand( KWTextFrameSet *fs, KoTextParag *parag );
00036     KoTextCursor *execute( KoTextCursor *c );
00037     KoTextCursor *unexecute( KoTextCursor *c );
00038 
00039     // Helper method, public for KWTextFrameSet::insertTOC().
00040     // Remove a toc based on the parag styles
00041     static KoTextCursor * removeTOC( KWTextFrameSet *fs, KoTextCursor *cursor, KMacroCommand *macroCmd );
00042 
00043 protected:
00044     // Find or create a toc style
00045     static KoParagStyle * findOrCreateTOCStyle( KWTextFrameSet *fs, int depth );
00046 
00047     int m_paragId;
00048 };
00049 
00050 
00051 
00052 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys