KParts

htmlextension.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2010 David Faure <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KPARTS_HTMLEXTENSION_H
9 #define KPARTS_HTMLEXTENSION_H
10 
11 #include <kparts/kparts_export.h>
12 
13 #include <QObject>
14 #include <memory>
15 
16 class QUrl;
17 
18 namespace KParts
19 {
20 class ReadOnlyPart;
21 class HtmlExtensionPrivate;
22 
23 /**
24  * @class HtmlExtension htmlextension.h <KParts/HtmlExtension>
25  *
26  * @short An extension for KParts to provide HTML-related features
27  *
28  * Use qobject_cast to cast the extension to interesting interfaces, like
29  * qobject_cast<KParts::SelectorInterface>.
30  *
31  * @since 4.6
32  */
33 class KPARTS_EXPORT HtmlExtension : public QObject
34 {
35  Q_OBJECT
36 public:
37  explicit HtmlExtension(KParts::ReadOnlyPart *parent);
38  ~HtmlExtension() override;
39 
40  /**
41  * Queries @p obj for a child object which inherits from this
42  * HtmlExtension class.
43  */
44  static HtmlExtension *childObject(QObject *obj);
45 
46  /**
47  * Returns the current base url of the part that implements this extension.
48  *
49  * This function is mostly used to resolve any relative URLs that might be
50  * returned when querying the part for links.
51  */
52  virtual QUrl baseUrl() const = 0;
53 
54  /**
55  * Returns true if portions of the content in the part that implements
56  * this extension are selected.
57  *
58  * By default this function returns false.
59  */
60  virtual bool hasSelection() const;
61 
62 private:
63  // for future extensions
64  std::unique_ptr<HtmlExtensionPrivate> const d;
65 };
66 
67 } // namespace KParts
68 
69 #endif /* KPARTS_HTMLEXTENSION_H */
An extension for KParts to provide HTML-related features.
Definition: htmlextension.h:33
Base class for any "viewer" part.
Definition: readonlypart.h:51
The KParts namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 03:51:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.