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

KParts

htmlextension.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2010 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KPARTS_HTMLEXTENSION_H
00021 #define KPARTS_HTMLEXTENSION_H
00022 
00023 #include <QtCore/QSharedDataPointer>
00024 #include <QtCore/QObject>
00025 
00026 #include <kparts/kparts_export.h>
00027 
00028 class KUrl;
00029 
00030 namespace KParts
00031 {
00032 
00033 class ReadOnlyPart;
00034 class HtmlExtensionPrivate;
00035 class SelectorInterfacePrivate;
00036 
00045 class KPARTS_EXPORT HtmlExtension : public QObject
00046 {
00047     Q_OBJECT
00048 public:
00049     HtmlExtension(KParts::ReadOnlyPart* parent);
00050     ~HtmlExtension();
00051 
00056     static HtmlExtension *childObject( QObject *obj );
00057 
00064     virtual KUrl baseUrl() const = 0;
00065 
00072     virtual bool hasSelection() const;
00073 
00074 private:
00075     // for future extensions
00076     HtmlExtensionPrivate* const d;
00077 };
00078 
00089 class KPARTS_EXPORT SelectorInterface
00090 {
00091 public:
00092     class ElementPrivate;
00093     class Element;
00094 
00098     enum QueryMethod {
00099         None = 0x00,                   
00100         EntireContent = 0x01,          
00101         SelectedContent = 0x02         
00102     };
00103     Q_DECLARE_FLAGS(QueryMethods, QueryMethod)
00104 
00105     
00108     virtual ~SelectorInterface() {}
00109 
00117     virtual QueryMethods supportedQueryMethods() const;
00118 
00132     virtual Element querySelector(const QString& query, QueryMethod method) const = 0;
00133 
00147     virtual QList<Element> querySelectorAll(const QString& query, QueryMethod method) const = 0;
00148 
00149     class KPARTS_EXPORT Element {
00150     public:
00154         Element();
00155 
00159         Element(const Element& other);
00160 
00164         ~Element();
00165 
00169         bool isNull() const;
00170 
00174         void setTagName(const QString& tag);
00175 
00179         QString tagName() const;
00180 
00185         void setAttribute(const QString& name, const QString& value);
00186 
00190         QStringList attributeNames() const;
00191 
00195         QString attribute(const QString& name, const QString& defaultValue = QString()) const;
00196 
00200         bool hasAttribute(const QString& name) const;
00201 
00202         // No namespace support yet, could be added with attributeNS, setAttributeNS
00203 
00207         void swap( Element& other ) {
00208             d.swap( other.d );
00209         }
00210 
00214         Element& operator=(const Element& other) {
00215             if ( this != &other ) {
00216                 Element copy( other );
00217                 swap( copy );
00218             }
00219             return *this;
00220         }
00221 
00222     private:
00223         QSharedDataPointer<ElementPrivate> d;
00224     };
00225 };
00226 
00227 } // namespace KParts
00228 
00229 inline void qSwap( KParts::SelectorInterface::Element & lhs, KParts::SelectorInterface::Element & rhs )
00230 {
00231     lhs.swap( rhs );
00232 }
00233 
00234 Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::SelectorInterface::QueryMethods)
00235 
00236 Q_DECLARE_TYPEINFO(KParts::SelectorInterface::Element, Q_MOVABLE_TYPE);
00237 
00238 Q_DECLARE_INTERFACE(KParts::SelectorInterface,
00239                     "org.kde.KParts.SelectorInterface")
00240 
00241 #endif /* KPARTS_HTMLEXTENSION_H */

KParts

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal