• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • ui
  • findbar
khtmlfind_p.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2008 Bernhard Beschow <bbeschow AT cs DOT tu-berlin DOT de>
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 #ifndef __khtml_find_p_h__
21 #define __khtml_find_p_h__
22 
23 #include <QObject>
24 
25 #include "xml/dom_nodeimpl.h"
26 
27 #include <kfind.h>
28 
29 #include <QStringList>
30 #include <QPointer>
31 #include "khtmlfindbar.h"
32 
33 class KHTMLPart;
34 class QString;
35 class QWidget;
36 class KFindDialog;
37 class KFind;
38 
46 class KHTMLFind : public QObject
47 {
48  Q_OBJECT
49 public:
50  KHTMLFind( KHTMLPart *part, KHTMLFind *parent=0 );
51  ~KHTMLFind();
52  void findTextBegin();
53  bool initFindNode( bool selection, bool reverse, bool fromCursor );
54  void createNewKFind( const QString &str, long options, QWidget *parent, KFindDialog *findDialog );
55  bool findTextNext( bool reverse = false );
56  KHTMLFindBar *findBar() const { return m_parent ? m_parent->findBar() : m_findDialog.data(); }
57 
58 public slots:
59  void activate();
60  void deactivate();
61 
62 private slots:
63  void slotFindDestroyed();
64  void slotSelectionChanged();
65  void slotHighlight( const QString &, int index, int length );
66  void slotSearchChanged();
67  void slotFindNext();
68  void slotFindPrevious();
69 
70 signals:
71  void foundMatch( const DOM::Selection &selection, int length );
72 
73 protected:
74  KFind *find() const { return m_find; }
75 
76 private:
77  KHTMLPart *m_part;
78 
79  struct StringPortion
80  {
81  // Just basic ref/deref on our node to make sure it doesn't get deleted
82  StringPortion( int i, DOM::NodeImpl* n ) : index(i), node(n) { if (node) node->ref(); }
83  StringPortion() : index(0), node(0) {} // for QValueList
84  StringPortion( const StringPortion& other ) : node(0) { operator=(other); }
85  StringPortion& operator=( const StringPortion& other ) {
86  index=other.index;
87  if (other.node) other.node->ref();
88  if (node) node->deref();
89  node=other.node;
90  return *this;
91  }
92  ~StringPortion() { if (node) node->deref(); }
93 
94  int index;
95  DOM::NodeImpl *node;
96  };
97  QList<StringPortion> m_stringPortions;
98 
99  KFind *m_find;
100  KHTMLFind *m_parent;
101  QPointer<KHTMLFindBar> m_findDialog;
102 
103  struct findState
104  {
105  findState() : options( 0 ), last_dir( -1 ) {}
106  QStringList history;
107  QString text;
108  int options;
109  int last_dir; // -1=unknown,0=forward,1=backward
110  };
111 
112  findState m_lastFindState;
113 
114  DOM::NodeImpl *m_findNode; // current node
115  DOM::NodeImpl *m_findNodeEnd; // end node
116  DOM::NodeImpl *m_findNodeStart; // start node
117  DOM::NodeImpl *m_findNodePrevious; // previous node used for find
118  int m_findPos; // current pos in current node
119  int m_findPosEnd; // pos in end node
120  int m_findPosStart; // pos in start node
121 };
122 
123 #endif
KFindDialog
KHTMLFind::initFindNode
bool initFindNode(bool selection, bool reverse, bool fromCursor)
Definition: khtmlfind.cpp:76
khtmlfindbar.h
KHTMLFind::findTextNext
bool findTextNext(bool reverse=false)
Definition: khtmlfind.cpp:286
QWidget
KHTMLPart
This class is khtml's main class.
Definition: khtml_part.h:206
KHTMLFind::deactivate
void deactivate()
Definition: khtmlfind.cpp:143
QString
QObject
kfind.h
KHTMLFind::findTextBegin
void findTextBegin()
Definition: khtmlfind.cpp:63
KHTMLFind::createNewKFind
void createNewKFind(const QString &str, long options, QWidget *parent, KFindDialog *findDialog)
Definition: khtmlfind.cpp:253
KHTMLFind
This class implements the find activity for the KHTMLPart.
Definition: khtmlfind_p.h:46
QStringList
KHTMLFindBar
Definition: khtmlfindbar.h:29
KHTMLFind::~KHTMLFind
~KHTMLFind()
Definition: khtmlfind.cpp:58
KFind
KHTMLFind::findBar
KHTMLFindBar * findBar() const
Definition: khtmlfind_p.h:56
KHTMLFind::KHTMLFind
KHTMLFind(KHTMLPart *part, KHTMLFind *parent=0)
Definition: khtmlfind.cpp:48
KHTMLFind::activate
void activate()
Definition: khtmlfind.cpp:185
KHTMLFind::find
KFind * find() const
Definition: khtmlfind_p.h:74
QList< StringPortion >
KHTMLFind::foundMatch
void foundMatch(const DOM::Selection &selection, int length)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal