kword

KWFrameSetEdit.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999, 2000 Reginald Stadlbauer <reggie@kde.org>
00003    Copyright (C) 2005 Thomas Zander <zander@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "KWFrameSetEdit.h"
00022 #include "KWView.h"
00023 #include "KWCanvas.h"
00024 #include "KWFrame.h"
00025 #include "KWAnchor.h"
00026 #include "KWFrameSet.h"
00027 #include "KWTextFrameSet.h"
00028 
00029 #include <KoTextParag.h>
00030 
00031 KWFrameSetEdit::KWFrameSetEdit( KWFrameSet * fs, KWCanvas * canvas )
00032      : m_fs(fs), m_canvas(canvas), m_currentFrame( fs->frame(0) )
00033 {
00034 }
00035 
00036 void KWFrameSetEdit::drawContents( QPainter *p, const QRect &crect,
00037                                    const QColorGroup &cg, bool onlyChanged, bool resetChanged,
00038                                    KWViewMode *viewMode, KWFrameViewManager *fvm )
00039 {
00040     //kdDebug(32001) << "KWFrameSetEdit::drawContents " << frameSet()->name() << endl;
00041     frameSet()->drawContents( p, crect, cg, onlyChanged, resetChanged, this, viewMode, fvm );
00042 }
00043 
00044 bool KWFrameSetEdit::exitLeft()
00045 {
00046     if ( m_fs->isFloating() ) {
00047         KWAnchor* anchor = m_fs->findAnchor( 0 );
00048         int index = anchor->index();
00049         KoTextParag *parag = anchor->paragraph();
00050         // This call deletes "this"!
00051         m_canvas->editTextFrameSet( m_fs->anchorFrameset(), parag, index );
00052         return true;
00053     }
00054     return false;
00055 }
00056 
00057 bool KWFrameSetEdit::exitRight()
00058 {
00059     if ( m_fs->isFloating() ) {
00060         KWAnchor* anchor = m_fs->findAnchor( 0 );
00061         int index = anchor->index();
00062         KoTextParag *parag = anchor->paragraph();
00063         // This call deletes "this"!
00064         m_canvas->editTextFrameSet( m_fs->anchorFrameset(), parag, index+1 );
00065         return true;
00066     }
00067     return false;
00068 }
KDE Home | KDE Accessibility Home | Description of Access Keys