1 /* 2 * Copyright 2016 Kai Pastor 3 * 4 * This file is part of OpenOrienteering. 5 * 6 * OpenOrienteering is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * OpenOrienteering is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with OpenOrienteering. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef OPENORIENTEERING_PRINTER_PROPERTIES_H 21 #define OPENORIENTEERING_PRINTER_PROPERTIES_H 22 23 #include <memory> 24 25 class QPrinter; 26 class QWidget; 27 28 29 /** 30 * Provides platform-dependent printer properties handling. 31 * 32 * At moment, a specific implementation exists for Win32, dealing with DEVMODE 33 * and DocumentProperties. 34 */ 35 namespace PlatformPrinterProperties 36 { 37 /** 38 * Saves the printer's platform-dependent properties. 39 * 40 * The buffer is reset to point to the saved data. 41 * 42 * The default implementation does nothing. 43 */ 44 void save(const QPrinter* printer, std::shared_ptr<void>& buffer); 45 46 /** 47 * Applies platform-dependent properties to the printer, if possible. 48 * 49 * The default implementation does nothing. 50 */ 51 void restore(QPrinter* printer, const std::shared_ptr<void>& buffer); 52 53 /** 54 * Returns true iff the platform supports execDialog(). 55 * 56 * The default implementation returns false. 57 */ 58 bool dialogSupported(); 59 60 /** 61 * Shows a modal properties dialog for the given printer. 62 * 63 * The printer parameter must not be nullptr. The buffer may return data 64 * which has to live as long as the printer object. 65 * 66 * Returns QDialog::Accepted or QDialog::Rejected, depending on user action. 67 * 68 * The default implementation returns QDialog::Rejected. 69 */ 70 int execDialog(QPrinter* printer, std::shared_ptr<void>& buffer, QWidget* parent = nullptr); 71 } 72 73 #endif // OPENORIENTEERING_PRINTER_PROPERTIES_H 74