LeechCraft  0.6.70-15082-g543737046d
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")
IAdvancedHTMLEditor
Interface for HTML/WYSIWYG editors with some advanced functionality.
Definition: iadvancedhtmleditor.h:36
QList
Definition: ianrulesstorage.h:14
IAdvancedHTMLEditor::CustomTag::FromKnown_
std::function< bool(QDomElement &)> FromKnown_
The converter of an instance of the tag from HTML.
Definition: iadvancedhtmleditor.h:113
IAdvancedHTMLEditor::CustomTags_t
QList< CustomTag > CustomTags_t
Definition: iadvancedhtmleditor.h:115
IAdvancedHTMLEditor::Replacements_t
QList< Replacement_t > Replacements_t
Definition: iadvancedhtmleditor.h:42
IAdvancedHTMLEditor::CustomTag::ToKnown_
std::function< void(QDomElement &)> ToKnown_
The converter of an instance of the tag to HTML.
Definition: iadvancedhtmleditor.h:81
LC::Empty
@ Empty
Empty partition without a type.
Definition: deviceroles.h:43
IAdvancedHTMLEditor::CustomTag::TagName_
QString TagName_
The name of the custom tag, like lj.
Definition: iadvancedhtmleditor.h:50
IAdvancedHTMLEditor::CustomTag
Describes a single custom tag.
Definition: iadvancedhtmleditor.h:46
IAdvancedHTMLEditor::~IAdvancedHTMLEditor
virtual ~IAdvancedHTMLEditor()
Definition: iadvancedhtmleditor.h:39
IAdvancedHTMLEditor::Replacement_t
QPair< QRegExp, QString > Replacement_t
Definition: iadvancedhtmleditor.h:41
IAdvancedHTMLEditor::CustomTag::TagType
TagType
Definition: iadvancedhtmleditor.h:52