kpresenter

KPrFindReplace.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001, Laurent Montel <lmontel@mandrakesoft.com>
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#include <kdebug.h>
21#include "KPrFindReplace.h"
22#include "KPrCanvas.h"
23#include "KPrView.h"
24#include "KPrDocument.h"
25#include "KPrTextObject.h"
26#include <KoTextObject.h>
27#include <kcommand.h>
28#include <KoSearchDia.h>
29#include "KPrTextDocument.h"
30
31KPrFindReplace::KPrFindReplace( TQWidget* parent, KPrCanvas * canvas, KoSearchDia * dialog,
32 const TQValueList<KoTextObject *> & lstObjects, KPrTextView *textView)
33 : KoFindReplace( parent, dialog, lstObjects, textView )
34{
35 m_canvas = canvas;
36}
37
38KPrFindReplace::KPrFindReplace( TQWidget* parent, KPrCanvas * canvas, KoReplaceDia * dialog,
39 const TQValueList<KoTextObject *> & lstObjects, KPrTextView *textView )
40 : KoFindReplace( parent, dialog, lstObjects, textView )
41{
42 m_canvas = canvas;
43}
44
45KPrFindReplace::~KPrFindReplace()
46{
47 //kdDebug(33001)() << "KPrFindReplace::~KPrFindReplace m_destroying=" << m_destroying << endl;
48}
49
50void KPrFindReplace::emitNewCommand(KCommand *cmd)
51{
52 m_canvas->getView()->kPresenterDoc()->addCommand(cmd);
53}
54
55void KPrFindReplace::highlightPortion(KoTextParag * parag, int index, int length, KoTextDocument *_textdoc, KDialogBase* dialog)
56{
57 bool repaint = isReplace() ? options() & KReplaceDialog::PromptOnReplace : true;
58 KPrTextDocument *textdoc = static_cast<KPrTextDocument *>(_textdoc);
59 KPrTextObject* textobj = textdoc->textObject();
60 textobj->highlightPortion( parag, index, length, m_canvas, repaint, dialog );
61}
62
63#include "KPrFindReplace.moc"
Class KPCanvas - There is a single instance of this class for a given view.
Definition KPrCanvas.h:82
KPrFindReplace(TQWidget *parent, KPrCanvas *canvas, KoSearchDia *dialog, const TQValueList< KoTextObject * > &lstObjects, KPrTextView *textView)
The parent widget can't be the canvas, otherwise the 'find next' dialog scrolls up/down when using th...
This is our KoTextDocument reimplementation, to relate it to the textobject it's in.
KPrTextObject * textObject() const
Return the text object in which this document is.