File indexing completed on 2024-06-02 05:26:05
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "knotes_export.h" 0010 0011 #include <QFont> 0012 #include <QObject> 0013 0014 #include <memory> 0015 0016 class QPrinter; 0017 class KNotePrintObject; 0018 class KNoteGrantleePrint; 0019 class KNOTES_EXPORT KNotePrinter : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit KNotePrinter(QObject *parent = nullptr); 0024 ~KNotePrinter() override; 0025 0026 void setDefaultFont(const QFont &font); 0027 [[nodiscard]] QFont defaultFont() const; 0028 void printNotes(const QList<KNotePrintObject *> &lst, const QString &themePath, bool preview); 0029 0030 private Q_SLOTS: 0031 void slotPrinterPage(QPrinter *printer); 0032 0033 private: 0034 void print(QPrinter &printer, const QString &htmlText); 0035 void doPrint(const QString &content, const QString &dialogCaption); 0036 void doPrintPreview(const QString &htmlText); 0037 0038 QFont m_defaultFont; 0039 QString mHtmlPreviewText; 0040 std::unique_ptr<KNoteGrantleePrint> mGrantleePrint; 0041 };