kword

KWFrameSetEdit.cpp
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999, 2000 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2005 Thomas Zander <zander@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#include "KWFrameSetEdit.h"
22#include "KWView.h"
23#include "KWCanvas.h"
24#include "KWFrame.h"
25#include "KWAnchor.h"
26#include "KWFrameSet.h"
27#include "KWTextFrameSet.h"
28
29#include <KoTextParag.h>
30
31KWFrameSetEdit::KWFrameSetEdit( KWFrameSet * fs, KWCanvas * canvas )
32 : m_fs(fs), m_canvas(canvas), m_currentFrame( fs->frame(0) )
33{
34}
35
36void KWFrameSetEdit::drawContents( TQPainter *p, const TQRect &crect,
37 const TQColorGroup &cg, bool onlyChanged, bool resetChanged,
38 KWViewMode *viewMode, KWFrameViewManager *fvm )
39{
40 //kdDebug(32001) << "KWFrameSetEdit::drawContents " << frameSet()->name() << endl;
41 frameSet()->drawContents( p, crect, cg, onlyChanged, resetChanged, this, viewMode, fvm );
42}
43
45{
46 if ( m_fs->isFloating() ) {
47 KWAnchor* anchor = m_fs->findAnchor( 0 );
48 int index = anchor->index();
49 KoTextParag *parag = anchor->paragraph();
50 // This call deletes "this"!
51 m_canvas->editTextFrameSet( m_fs->anchorFrameset(), parag, index );
52 return true;
53 }
54 return false;
55}
56
58{
59 if ( m_fs->isFloating() ) {
60 KWAnchor* anchor = m_fs->findAnchor( 0 );
61 int index = anchor->index();
62 KoTextParag *parag = anchor->paragraph();
63 // This call deletes "this"!
64 m_canvas->editTextFrameSet( m_fs->anchorFrameset(), parag, index+1 );
65 return true;
66 }
67 return false;
68}
An anchor is a special character, or 'custom item'.
Definition KWAnchor.h:35
Class: KWCanvas This class is responsible for the rendering of the frames to the screen as well as th...
Definition KWCanvas.h:61
virtual void drawContents(TQPainter *, const TQRect &, const TQColorGroup &, bool onlyChanged, bool resetChanged, KWViewMode *viewMode, KWFrameViewManager *frameViewManager)
Paint this frameset in "has focus" mode (e.g.
bool exitLeft()
Called if the cursor tries to leave the frameset at its beginning.
bool exitRight()
Called if the cursor tries to leave the frameset at its end.
Class: KWFrameSet Base type, a frameset holds content as well as frames to show that content.
Definition KWFrameSet.h:62
Class that knows about all the (visible) frames in the document and will act as a manager between the...
Abstract base class for KWCanvas's view modes.
Definition KWViewMode.h:48