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> inline bool renderWithFactory(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer)
32  {
33  return renderWithFactory(&T::staticMetaObject, msgPart, writer);
34  }
35 
36  inline bool renderWithFactory(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer)
37  {
38  return renderWithFactory(msgPart->metaObject(), msgPart, writer);
39  }
40 
41  virtual void renderSubParts(const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *htmlWriter) = 0;
42 
43  virtual Q_REQUIRED_RESULT bool isHiddenHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
44  virtual Q_REQUIRED_RESULT MimeTreeParser::IconType displayHint(const MimeTreeParser::MessagePart::Ptr &msgPart) = 0;
45  virtual Q_REQUIRED_RESULT bool showEmoticons() const = 0;
46  virtual Q_REQUIRED_RESULT bool isPrinting() const = 0;
47  virtual Q_REQUIRED_RESULT bool htmlLoadExternal() const = 0;
48  virtual Q_REQUIRED_RESULT bool showExpandQuotesMark() const = 0;
49  virtual Q_REQUIRED_RESULT bool showOnlyOneMimePart() const = 0;
50  virtual Q_REQUIRED_RESULT bool showSignatureDetails() const = 0;
51  virtual Q_REQUIRED_RESULT bool showEncryptionDetails() const = 0;
52  virtual Q_REQUIRED_RESULT int levelQuote() const = 0;
53 
54 protected:
55  virtual Q_REQUIRED_RESULT bool renderWithFactory(const QMetaObject *mo, const MimeTreeParser::MessagePart::Ptr &msgPart, HtmlWriter *writer) = 0;
56 };
57 /**
58  * @brief The MessagePartRendererBase class
59  */
60 class MESSAGEVIEWER_EXPORT MessagePartRendererBase
61 {
62 public:
64  virtual ~MessagePartRendererBase();
65  virtual Q_REQUIRED_RESULT bool render(const MimeTreeParser::MessagePart::Ptr &, HtmlWriter *htmlWriter, RenderContext *context) const = 0;
66 };
67 }
The CSSHelperBase class.
Definition: csshelperbase.h:26
The MessagePartRendererBase class.
An interface for HTML sinks.
Definition: htmlwriter.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.