LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
iadvancedhtmleditor.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <functional>
12 #include <QPair>
13 #include <QList>
14 #include <QRegExp>
15 
16 class QDomElement;
17 
36 class Q_DECL_EXPORT IAdvancedHTMLEditor
37 {
38 public:
39  virtual ~IAdvancedHTMLEditor () {}
40 
41  typedef QPair<QRegExp, QString> Replacement_t;
43 
46  struct CustomTag
47  {
50  QString TagName_;
51 
52  enum class TagType
53  {
54  Empty,
55  Inline,
56  Block
57  };
58 
59  TagType TagType_ = TagType::Inline;
60 
81  std::function<void (QDomElement&)> ToKnown_;
82 
113  std::function<bool (QDomElement&)> FromKnown_;
114  };
116 
124  virtual void InsertHTML (const QString& html) = 0;
125 
135  virtual void SetCustomTags (const CustomTags_t& tags) = 0;
136 
154  virtual QAction* AddInlineTagInserter (const QString& tagName, const QVariantMap& params) = 0;
155 
160  virtual void ExecJS (const QString& js) = 0;
161 };
162 
163 Q_DECLARE_INTERFACE (IAdvancedHTMLEditor, "org.Deviant.LeechCraft.IAdvancedHTMLEditor/1.0")
Empty partition without a type.
Definition: deviceroles.h:31
std::function< bool(QDomElement &)> FromKnown_
The converter of an instance of the tag from HTML.
QPair< QRegExp, QString > Replacement_t
QList< Replacement_t > Replacements_t
QString TagName_
The name of the custom tag, like lj.
QList< CustomTag > CustomTags_t
Describes a single custom tag.
std::function< void(QDomElement &)> ToKnown_
The converter of an instance of the tag to HTML.
Interface for HTML/WYSIWYG editors with some advanced functionality.