1 /*
2     This file is part of the Okteta Kasten module, made within the KDE community.
3 
4     SPDX-FileCopyrightText: 2007-2008 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #ifndef KASTEN_PRINTTOOL_HPP
10 #define KASTEN_PRINTTOOL_HPP
11 
12 // Qt
13 #include <QObject>
14 
15 namespace Okteta {
16 class AbstractByteArrayModel;
17 }
18 
19 class QPrinter;
20 
21 namespace Kasten {
22 
23 class ByteArrayView;
24 class ByteArrayDocument;
25 class AbstractModel;
26 
27 /**
28    This tool cares for the printing of the byte array to a series of papers.
29    This is done by creating a series of print commands, which may also
30    be in form of a pdf document. We don't care for this, it's done
31    by Qt and the print dialog.
32 
33    The content is printed into a series of frames. By default there are
34    a header frame, the content frame and the footer frame on each page.
35 
36 
37    -> Header printer, footer printer, content printer
38    -> called by a pageprinter which knows about the layout
39    -> pageprinter controls the page settings and informs the embedded printer
40    -> frameprinter return number of frames they need for their content
41    -> endless frames vs. ending frames
42    -> vars for each frame: see KWrite
43    ->
44 
45  */
46 class PrintTool : public QObject
47 {
48     Q_OBJECT
49 
50 public:
51     PrintTool();
52     ~PrintTool() override;
53 
54 public:
55     void setTargetModel(AbstractModel* model);
56 
57 public Q_SLOTS:
58     void print();
59 
60 Q_SIGNALS:
61     void viewChanged(bool hasView);
62 
63 private Q_SLOTS:
64     void triggerPrint(QPrinter* printer);
65 
66 private:
67     ByteArrayDocument* mDocument = nullptr;
68 
69     ByteArrayView* mByteArrayView = nullptr;
70     Okteta::AbstractByteArrayModel* mByteArrayModel = nullptr;
71 };
72 
73 }
74 
75 #endif
76