File indexing completed on 2024-04-21 14:46:30

0001 /*
0002     SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QRectF>
0010 
0011 #include <memory>
0012 
0013 class QPrinter;
0014 class QString;
0015 class QTextDocument;
0016 
0017 /**
0018  * @class KStarsDocument
0019  * @brief Base class for KStars documents.
0020  * KStarsDocument is a base class for all KStars documents: finder charts, logging forms
0021  * etc.
0022  *
0023  * @author Rafał Kułaga
0024  */
0025 class KStarsDocument
0026 {
0027   public:
0028     /** Constructor */
0029     KStarsDocument();
0030 
0031     /** Clears contents of the document. */
0032     void clearContent();
0033 
0034     /**
0035      * @brief Print contents of the document.
0036      * @param printer Printer on which document will be printed.
0037      */
0038     void print(QPrinter *printer);
0039 
0040     /**
0041      * @brief Write contents of the document to Open Document Text file.
0042      * @param fname File name.
0043      * @return Returns true if write is successful.
0044      */
0045     bool writeOdt(const QString &fname);
0046 
0047     /**
0048      * @brief Write contents of the document to the Postscript/PDF file.
0049      * @param fname File name.
0050      */
0051     void writePsPdf(const QString &fname);
0052 
0053   protected:
0054     std::unique_ptr<QTextDocument> m_Document;
0055 };