LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
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
16class QDomElement;
17
36class Q_DECL_EXPORT IAdvancedHTMLEditor
37{
38public:
40
41 typedef QPair<QRegExp, QString> Replacement_t;
43
46 struct CustomTag
47 {
50 QString TagName_;
51
72 std::function<void (QDomElement&)> ToKnown_;
73
104 std::function<bool (QDomElement&)> FromKnown_;
105 };
107
115 virtual void InsertHTML (const QString& html) = 0;
116
126 virtual void SetCustomTags (const CustomTags_t& tags) = 0;
127
145 virtual QAction* AddInlineTagInserter (const QString& tagName, const QVariantMap& params) = 0;
146
151 virtual void ExecJS (const QString& js) = 0;
152};
153
154Q_DECLARE_INTERFACE (IAdvancedHTMLEditor, "org.Deviant.LeechCraft.IAdvancedHTMLEditor/1.0")
Interface for HTML/WYSIWYG editors with some advanced functionality.
virtual void InsertHTML(const QString &html)=0
Inserts the given HTML at the current cursor position.
virtual QAction * AddInlineTagInserter(const QString &tagName, const QVariantMap &params)=0
Adds a custom action to wrap selected text into given tag.
virtual void ExecJS(const QString &js)=0
Executes the given js in the context of the content.
QPair< QRegExp, QString > Replacement_t
QList< Replacement_t > Replacements_t
QList< CustomTag > CustomTags_t
virtual void SetCustomTags(const CustomTags_t &tags)=0
Adds support for custom tags not present in HTML standard.
Describes a single custom tag.
std::function< bool(QDomElement &)> FromKnown_
The converter of an instance of the tag from HTML.
QString TagName_
The name of the custom tag, like lj.
std::function< void(QDomElement &)> ToKnown_
The converter of an instance of the tag to HTML.