Messagelib

messagepartrendererbase.h
1/*
2 SPDX-FileCopyrightText: 2017 Sandro Knauß <sknauss@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messageviewer_export.h"
10
11#include <MimeTreeParser/MessagePart>
12
13#include <map>
14#include <memory>
15
16#include <QSharedPointer>
17
18namespace MessageViewer
19{
20class CSSHelperBase;
21class HtmlWriter;
22/**
23 * @brief The RenderContext class
24 */
25class MESSAGEVIEWER_EXPORT RenderContext
26{
27public:
28 virtual ~RenderContext();
29
30 virtual CSSHelperBase *cssHelper() const = 0;
31 template<typename T>
32 inline bool renderWithFactory(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer)
33 {
34 return renderWithFactory(&T::staticMetaObject, msgPart, writer);
35 }
36
37 inline bool renderWithFactory(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer)
38 {
39 return renderWithFactory(msgPart->metaObject(), msgPart, writer);
40 }
41
42 virtual void renderSubParts(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *htmlWriter) = 0;
43
44 [[nodiscard]] virtual bool isHiddenHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
45 [[nodiscard]] virtual MimeTreeParser::IconType displayHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
46 [[nodiscard]] virtual bool showEmoticons() const = 0;
47 [[nodiscard]] virtual bool isPrinting() const = 0;
48 [[nodiscard]] virtual bool htmlLoadExternal() const = 0;
49 [[nodiscard]] virtual bool showExpandQuotesMark() const = 0;
50 [[nodiscard]] virtual bool showOnlyOneMimePart() const = 0;
51 [[nodiscard]] virtual bool showSignatureDetails() const = 0;
52 [[nodiscard]] virtual bool showEncryptionDetails() const = 0;
53 [[nodiscard]] virtual int levelQuote() const = 0;
54
55protected:
56 [[nodiscard]] virtual bool renderWithFactory(const QMetaObject *mo, const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer) = 0;
57};
58/**
59 * @brief The MessagePartRendererBase class
60 */
61class MESSAGEVIEWER_EXPORT MessagePartRendererBase
62{
63public:
66 [[nodiscard]] virtual bool render(const MimeTreeParser::MessagePart::Ptr &, HtmlWriter *htmlWriter, RenderContext *context) const = 0;
67};
68}
The CSSHelperBase class.
An interface for HTML sinks.
Definition htmlwriter.h:29
The MessagePartRendererBase class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.