Messagelib

messagepartrendererbase.h
1 /*
2  SPDX-FileCopyrightText: 2017 Sandro KnauƟ <[email protected]>
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 
18 namespace MessageViewer
19 {
20 class CSSHelperBase;
21 class HtmlWriter;
22 /**
23  * @brief The RenderContext class
24  */
25 class MESSAGEVIEWER_EXPORT RenderContext
26 {
27 public:
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  Q_REQUIRED_RESULT virtual bool isHiddenHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
45  Q_REQUIRED_RESULT virtual MimeTreeParser::IconType displayHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
46  Q_REQUIRED_RESULT virtual bool showEmoticons() const = 0;
47  Q_REQUIRED_RESULT virtual bool isPrinting() const = 0;
48  Q_REQUIRED_RESULT virtual bool htmlLoadExternal() const = 0;
49  Q_REQUIRED_RESULT virtual bool showExpandQuotesMark() const = 0;
50  Q_REQUIRED_RESULT virtual bool showOnlyOneMimePart() const = 0;
51  Q_REQUIRED_RESULT virtual bool showSignatureDetails() const = 0;
52  Q_REQUIRED_RESULT virtual bool showEncryptionDetails() const = 0;
53  Q_REQUIRED_RESULT virtual int levelQuote() const = 0;
54 
55 protected:
56  Q_REQUIRED_RESULT virtual bool renderWithFactory(const QMetaObject *mo, const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer) = 0;
57 };
58 /**
59  * @brief The MessagePartRendererBase class
60  */
61 class MESSAGEVIEWER_EXPORT MessagePartRendererBase
62 {
63 public:
65  virtual ~MessagePartRendererBase();
66  Q_REQUIRED_RESULT virtual bool render(const MimeTreeParser::MessagePart::Ptr &, HtmlWriter *htmlWriter, RenderContext *context) const = 0;
67 };
68 }
The MessagePartRendererBase class.
The CSSHelperBase class.
Definition: csshelperbase.h:26
An interface for HTML sinks.
Definition: htmlwriter.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue May 17 2022 04:00:04 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.