Warning, file /office/calligra/libs/odf/KoPageFormat.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
0003    Copyright 2002, 2003 David Faure <faure@kde.org>
0004    Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
0005    Copyright 2007 Thomas Zander <zander@kde.org>
0006 
0007    This library is free software; you can redistribute it and/or
0008    modify it under the terms of the GNU Library General Public
0009    License as published by the Free Software Foundation; either
0010    version 2 of the License, or (at your option) any later version.
0011 
0012    This library is distributed in the hope that it will be useful,
0013    but WITHOUT ANY WARRANTY; without even the implied warranty of
0014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015    Library General Public License for more details.
0016 
0017    You should have received a copy of the GNU Library General Public License
0018    along with this library; see the file COPYING.LIB.  If not, write to
0019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  * Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef KOPAGEFORMAT_H
0024 #define KOPAGEFORMAT_H
0025 
0026 #include "koodf_export.h"
0027 
0028 #include <QPrinter>
0029 
0030 /// The page formats calligra supports
0031 namespace KoPageFormat
0032 {
0033 /**
0034  * @brief Represents the paper format a document shall be printed on.
0035  *
0036  * For compatibility reasons, and because of screen and custom,
0037  * this enum doesn't map to QPrinter::PageSize but KoPageFormat::printerPageSize
0038  * does the conversion.
0039  */
0040 enum Format {
0041     IsoA3Size,
0042     IsoA4Size,
0043     IsoA5Size,
0044     UsLetterSize,
0045     UsLegalSize,
0046     ScreenSize,
0047     CustomSize,
0048     IsoB5Size,
0049     UsExecutiveSize,
0050     IsoA0Size,
0051     IsoA1Size,
0052     IsoA2Size,
0053     IsoA6Size,
0054     IsoA7Size,
0055     IsoA8Size,
0056     IsoA9Size,
0057     IsoB0Size,
0058     IsoB1Size,
0059     IsoB10Size,
0060     IsoB2Size,
0061     IsoB3Size,
0062     IsoB4Size,
0063     IsoB6Size,
0064     IsoC5Size,
0065     UsComm10Size,
0066     IsoDLSize,
0067     UsFolioSize,
0068     UsLedgerSize,
0069     UsTabloidSize
0070 };
0071 
0072 /**
0073  *  Represents the orientation of a printed document.
0074  */
0075 enum Orientation {
0076     Portrait,
0077     Landscape
0078 };
0079 
0080 /**
0081  * @brief Convert a Format into a KPrinter::PageSize.
0082  *
0083  * If format is 'screen' it will use A4 landscape.
0084  * If format is 'custom' it will use A4 portrait.
0085  * (you may want to take care of those cases separately).
0086  * Usually passed to KPrinter::setPageSize().
0087  */
0088 KOODF_EXPORT QPrinter::PageSize printerPageSize(Format format);
0089 
0090 /**
0091  * Returns the width (in mm) for a given page format and orientation
0092  * 'Custom' isn't supported by this function, obviously.
0093  */
0094 KOODF_EXPORT qreal width(Format format, Orientation orientation = Landscape);
0095 
0096 /**
0097  * Returns the height (in mm) for a given page format and orientation
0098  * 'Custom' isn't supported by this function, obviously.
0099  */
0100 KOODF_EXPORT qreal height(Format format, Orientation orientation  = Landscape);
0101 
0102 /**
0103  * Returns the internal name of the given page format.
0104  * Use for saving.
0105  */
0106 KOODF_EXPORT QString formatString(Format format);
0107 
0108 /**
0109  * Convert a format string (internal name) to a page format value.
0110  * Use for loading.
0111  */
0112 KOODF_EXPORT Format formatFromString(const QString &string);
0113 
0114 /**
0115  * Returns the default format (based on the KControl settings)
0116  */
0117 KOODF_EXPORT Format defaultFormat();
0118 
0119 /**
0120  * Returns the translated name of the given page format.
0121  * Use for showing the user.
0122  */
0123 KOODF_EXPORT QString name(Format format);
0124 
0125 /**
0126  * Lists the translated names of all the available formats
0127  */
0128 KOODF_EXPORT QStringList localizedPageFormatNames();
0129 
0130 /**
0131  * Lists the non-translated names of all the available formats
0132  */
0133 KOODF_EXPORT QStringList pageFormatNames();
0134 
0135 /**
0136  * Try to find the paper format for the given width and height (in mm).
0137  * Useful to some import filters.
0138  */
0139 KOODF_EXPORT Format guessFormat(qreal width, qreal height);
0140 }
0141 
0142 #endif
0143