kword

KWFindReplace.cpp
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2001, S.R.Haque <srhaque@iee.org>
4 Copyright (C) 2001, David Faure <faure@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#include <kdebug.h>
23#include "KWFindReplace.h"
24#include "KWCanvas.h"
25#include "KWDocument.h"
26#include "KWTextFrameSet.h"
27#include <KoTextObject.h>
28#include <kcommand.h>
29#include <KoSearchDia.h>
30#include "KWTextDocument.h"
31//#include <KoTextDocument.h>
32
33KWFindReplace::KWFindReplace( KWCanvas * canvas, KoSearchDia * dialog, const TQValueList<KoTextObject *> & lstObjects, KWTextFrameSetEdit *textView)
34 : KoFindReplace( canvas, dialog, lstObjects, textView )
35{
36 m_canvas = canvas;
37}
38
39KWFindReplace::KWFindReplace( KWCanvas * canvas, KoReplaceDia * dialog, const TQValueList<KoTextObject *> & lstObjects, KWTextFrameSetEdit *textView )
40 : KoFindReplace( canvas, dialog, lstObjects, textView )
41{
42 m_canvas = canvas;
43}
44
45KWFindReplace::~KWFindReplace()
46{
47 //kdDebug() << "KWFindReplace::~KWFindReplace m_destroying=" << m_destroying << endl;
48}
49
50void KWFindReplace::emitNewCommand(KCommand *cmd)
51{
52 m_canvas->kWordDocument()->addCommand(cmd);
53}
54
55void KWFindReplace::highlightPortion(KoTextParag * parag, int index, int length, KoTextDocument *textdocument, KDialogBase* dialog)
56{
57 KWTextDocument *textdoc=static_cast<KWTextDocument *>(textdocument);
58 bool repaint = isReplace() ? options() & KReplaceDialog::PromptOnReplace : true;
59 textdoc->textFrameSet()->highlightPortion( parag, index, length, m_canvas, repaint, dialog );
60}
61
62#include "KWFindReplace.moc"
Class: KWCanvas This class is responsible for the rendering of the frames to the screen as well as th...
Definition KWCanvas.h:61
This is our KoTextDocument reimplementation, to create KWTextParag instead of KoTextParags,...
KWTextFrameSet * textFrameSet() const
Return the text frameset in which this document is.
Object that is created to edit a Text frame set (KWTextFrameSet).
void highlightPortion(KoTextParag *parag, int index, int length, KWCanvas *canvas, bool repaint=true, KDialogBase *dialog=0)
Highlighting support (for search/replace, spellchecking etc.)