Messagelib

htmlblock.h
1/*
2 SPDX-FileCopyrightText: 2015 Sandro Knauß <sknauss@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messageviewer_export.h"
10
11#include <QSharedPointer>
12#include <QString>
13
14namespace KMime
15{
16class Content;
17}
18
19namespace MessageViewer
20{
21class HtmlWriter;
22/**
23 * @brief The HTMLBlock class
24 */
25class MESSAGEVIEWER_EXPORT HTMLBlock
26{
27public:
29
30 HTMLBlock();
31
32 virtual ~HTMLBlock();
33
34 [[nodiscard]] QString enter();
35 [[nodiscard]] QString exit();
36
37protected:
38 [[nodiscard]] QString dir() const;
39 virtual QString enterString() const = 0;
40 virtual QString exitString() const = 0;
41
42private:
43 bool entered = false;
44};
45
46// The attachment mark is a div that is placed around the attachment. It is used for drawing
47// a yellow border around the attachment when scrolling to it. When scrolling to it, the border
48// color of the div is changed, see KMReaderWin::scrollToAttachment().
49/**
50 * @brief The AttachmentMarkBlock class
51 */
52class MESSAGEVIEWER_EXPORT AttachmentMarkBlock : public HTMLBlock
53{
54public:
56 ~AttachmentMarkBlock() override;
57
58protected:
59 [[nodiscard]] QString enterString() const override;
60 [[nodiscard]] QString exitString() const override;
61
62private:
63 void internalEnter();
64 void internalExit();
65
66 KMime::Content *const mNode;
67 HtmlWriter *const mWriter;
68};
69
70// Make sure the whole content is relative, so that nothing is painted over the header
71// if a malicious message uses absolute positioning.
72// Also force word wrapping, which is useful for printing, see https://issues.kolab.org/issue3992.
73class RootBlock : public HTMLBlock
74{
75public:
76 explicit RootBlock(HtmlWriter *writer);
77 ~RootBlock() override;
78
79protected:
80 [[nodiscard]] QString enterString() const override;
81 [[nodiscard]] QString exitString() const override;
82
83private:
84 void internalEnter();
85 void internalExit();
86
87 HtmlWriter *mWriter = nullptr;
88};
89}
The AttachmentMarkBlock class.
Definition htmlblock.h:53
The HTMLBlock class.
Definition htmlblock.h:26
An interface for HTML sinks.
Definition htmlwriter.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:53:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.