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

0001 /*
0002    This file is part of the KDE project
0003    Copyright (C) 2000 Werner Trobin <trobin@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef koTemplate_h
0022 #define koTemplate_h
0023 
0024 #include <QString>
0025 #include <QPixmap>
0026 
0027 /**
0028  * @internal
0029  * This class represents a template as seen internally by Calligra. It is a collection
0030  * of information describing one template (and optionally one variation of the template)
0031  *
0032  * If there are more templates with the same name, the variant name can be used to distinguish
0033  * the different templates from each other. It may also exist as both a wide screen and non-
0034  * wide screen version.
0035  * As an example, take the Stage template Skyline. This exists in a set of three variations:
0036  * - Monotone
0037  * - Morning
0038  * - Night
0039  * Each of these variations further exist in both a wide screen and non-wide screen version.
0040  * The description of this, as found in the template's .desktop description file is:
0041  * @code
0042 [Desktop Entry]
0043 Icon=skyline_night_wide
0044 Name=Skyline Wide
0045 Comment=Skyline Night Wide
0046 Type=Link
0047 URL=.source/skyline_night_wide.otp
0048 X-KDE-Hidden=false
0049 X-KDE-TemplateIsWideFormat=true
0050 X-KDE-Thumbnail=.thumbnail/skyline_night_wide.png
0051 X-KDE-VariantName=Night
0052 X-KDE-Color=purple
0053 @endcode
0054  * Note, the code above doesn't include any translations as found in the actual file, which can
0055  * be found in the codebase under stage/templates/odf/skyline_night_wide.desktop
0056  * The location of files (the URL and X-KDE-Thumbnail entries specifically) are relative to the
0057  * location of the .desktop file.
0058  */
0059 class KoTemplate
0060 {
0061 
0062 public:
0063     explicit KoTemplate(const QString &name,
0064                         const QString &description = QString(),
0065                         const QString &file = QString(),
0066                         const QString &picture = QString(),
0067                         const QString &fileName = QString(),
0068                         const QString &_measureSystem = QString(),
0069                         const QString &color = QString(),
0070                         const QString &swatch = QString(),
0071                         const QString &variantName = QString(),
0072                         bool wide = false,
0073                         bool hidden = false, bool touched = false);
0074     ~KoTemplate() {}
0075 
0076     QString name() const {
0077         return m_name;
0078     }
0079     QString description() const {
0080         return m_descr;
0081     }
0082     QString file() const {
0083         return m_file;
0084     }
0085     QString picture() const {
0086         return m_picture;
0087     }
0088     QString fileName() const {
0089         return m_fileName;
0090     }
0091     const QPixmap &loadPicture();
0092 
0093     bool isHidden() const {
0094         return m_hidden;
0095     }
0096     void setHidden(bool hidden = true) {
0097         m_hidden = hidden; m_touched = true;
0098     }
0099 
0100     bool touched() const {
0101         return m_touched;
0102     }
0103 
0104     QString measureSystem() const {
0105         return m_measureSystem;
0106     }
0107     void setMeasureSystem(const QString& system) {
0108         m_measureSystem = system;
0109     }
0110 
0111     QString color() const {
0112         return m_color;
0113     }
0114     void setColor(const QString& color) {
0115         m_color = color;
0116     }
0117 
0118     QString swatch() const {
0119         return m_swatch;
0120     }
0121     void setSwatch(const QString& swatch) {
0122         m_swatch = swatch;
0123     }
0124 
0125     QString variantName() const {
0126         return m_variantName;
0127     }
0128     void setVariantName(const QString& variantName) {
0129         m_variantName = variantName;
0130     }
0131 
0132     QString thumbnail() const {
0133         return m_thumbnail;
0134     }
0135     void setThumbnail(const QString& thumbnail) {
0136         m_thumbnail = thumbnail;
0137     }
0138 
0139     bool wide() const {
0140         return m_wide;
0141     }
0142     void setWide(bool wide) {
0143         m_wide = wide;
0144     }
0145 private:
0146     QString m_name, m_descr, m_file, m_picture, m_fileName, m_color, m_swatch, m_variantName, m_thumbnail;
0147     bool m_wide;
0148     bool m_hidden;
0149     mutable bool m_touched;
0150     bool m_cached;
0151     QPixmap m_pixmap;
0152     QString m_measureSystem;
0153 };
0154 
0155 
0156 #endif