File indexing completed on 2024-06-23 05:48:53
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2007-2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_PRINTTOOL_HPP 0010 #define KASTEN_PRINTTOOL_HPP 0011 0012 // Qt 0013 #include <QObject> 0014 0015 namespace Okteta { 0016 class AbstractByteArrayModel; 0017 } 0018 0019 class QPrinter; 0020 0021 namespace Kasten { 0022 0023 class ByteArrayView; 0024 class ByteArrayDocument; 0025 class AbstractModel; 0026 0027 /** 0028 This tool cares for the printing of the byte array to a series of papers. 0029 This is done by creating a series of print commands, which may also 0030 be in form of a pdf document. We don't care for this, it's done 0031 by Qt and the print dialog. 0032 0033 The content is printed into a series of frames. By default there are 0034 a header frame, the content frame and the footer frame on each page. 0035 0036 0037 -> Header printer, footer printer, content printer 0038 -> called by a pageprinter which knows about the layout 0039 -> pageprinter controls the page settings and informs the embedded printer 0040 -> frameprinter return number of frames they need for their content 0041 -> endless frames vs. ending frames 0042 -> vars for each frame: see KWrite 0043 -> 0044 0045 */ 0046 class PrintTool : public QObject 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 PrintTool(); 0052 ~PrintTool() override; 0053 0054 public: 0055 void setTargetModel(AbstractModel* model); 0056 0057 public Q_SLOTS: 0058 void print(); 0059 0060 Q_SIGNALS: 0061 void viewChanged(bool hasView); 0062 0063 private Q_SLOTS: 0064 void triggerPrint(QPrinter* printer); 0065 0066 private: 0067 ByteArrayDocument* mDocument = nullptr; 0068 0069 ByteArrayView* mByteArrayView = nullptr; 0070 Okteta::AbstractByteArrayModel* mByteArrayModel = nullptr; 0071 }; 0072 0073 } 0074 0075 #endif