File indexing completed on 2024-05-19 15:27:52
0001 /* This file is part of KGraphViewer. 0002 Copyright (C) 2005-2007 Gael de Chalendar <kleag@free.fr> 0003 0004 KGraphViewer is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU General Public 0006 License as published by the Free Software Foundation, version 2. 0007 0008 This program is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 General Public License for more details. 0012 0013 You should have received a copy of the GNU General Public License 0014 along with this program; if not, write to the Free Software 0015 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0016 02110-1301, USA 0017 */ 0018 0019 /* This file was part of the KDE project 0020 Copyright (C) 2005 Jarosław Staniek <staniek@kde.org> 0021 0022 This program is free software; you can redistribute it and/or 0023 modify it under the terms of the GNU Library General Public 0024 License as published by the Free Software Foundation; either 0025 version 2 of the License, or (at your option) any later version. 0026 */ 0027 0028 #ifndef KGVSIMPLEPRINTINGCOMMAND_H 0029 #define KGVSIMPLEPRINTINGCOMMAND_H 0030 0031 #include "simpleprintingengine.h" 0032 #include <dotgraphview.h> 0033 #include <kgraphviewer_part.h> 0034 0035 namespace KGraphViewer 0036 { 0037 class KGVSimplePrintPreviewWindow; 0038 0039 /*! @short A command for simple printing and print preview. 0040 This class is instantiated in KGVMainWindowImpl so there's: 0041 - a single print preview window per part item regardless of a way how user invoked 0042 the 'print preview' command (using 'File->Print Preview' command or 'Print Preview' button 0043 of the 'Page Setup' dialog) 0044 - a single printing engine per part item regardless of a way how user started 0045 (using 'File->Print' command or 'Print' button of the 'Page Setup' dialog) 0046 */ 0047 class KGVSimplePrintingCommand : public QObject 0048 { 0049 Q_OBJECT 0050 0051 public: 0052 KGVSimplePrintingCommand(DotGraphView *mainWin, int objectId, QObject *parent = nullptr); 0053 ~KGVSimplePrintingCommand(); 0054 0055 inline KGVSimplePrintingEngine *engine() 0056 { 0057 return m_previewEngine; 0058 } 0059 0060 void hidePageSetup(); 0061 void hidePrintPreview(); 0062 0063 public Q_SLOTS: 0064 bool print(const QString &aTitleText = QString()); 0065 bool showPrintPreview(const QString &aTitleText = QString(), bool reload = false); 0066 void showPageSetup(const QString &aTitleText = QString()); 0067 0068 Q_SIGNALS: 0069 //! connected to KGV Main Window 0070 void showPageSetupRequested(); 0071 0072 protected Q_SLOTS: 0073 void slotShowPageSetupRequested(); 0074 0075 protected: 0076 bool init(const QString &aTitleText = QString()); 0077 0078 KGVSimplePrintingEngine *m_previewEngine; 0079 DotGraphView *m_graphView; 0080 int m_objectId; 0081 KGVSimplePrintingSettings *m_settings; 0082 KGVSimplePrintPreviewWindow *m_previewWindow; 0083 bool m_printPreviewNeedsReloading : 1; 0084 QDialog *m_pageSetupDialog; 0085 }; 0086 0087 } 0088 0089 #endif