Warning, file /office/calligra/libs/rdf/KoSemanticStylesheet.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) 2010 KO GmbH <ben.martin@kogmbh.com>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef __rdf_KoSemanticStylesheet_h__
0021 #define __rdf_KoSemanticStylesheet_h__
0022 
0023 #include "kordf_export.h"
0024 
0025 #include "RdfForward.h"
0026 // Qt
0027 #include <QObject>
0028 #include <QSharedData>
0029 #include <QList>
0030 #include <QString>
0031 
0032 class KoSemanticStylesheetPrivate;
0033 
0034 /**
0035  * @short A stylesheet that knows how to format a given KoRdfSemanticItem
0036  *
0037  * If you are looking to apply a stylesheet you should use the KoRdfSemanticItemViewSite
0038  * class. For example:
0039  *
0040  * KoRdfSemanticItemViewSite vs( SemanticItemPtr, xmlid );
0041  * vs.applyStylesheet( canvas, StylesheetPtr );
0042  *
0043  * @author Ben Martin <ben.martin@kogmbh.com>
0044  * @see KoRdfSemanticItem
0045  * @see KoRdfSemanticItemViewSite
0046  * @see KoDocumentRdf
0047  */
0048 class KORDF_EXPORT KoSemanticStylesheet : public QObject, public QSharedData
0049 {
0050     Q_OBJECT
0051     KoSemanticStylesheetPrivate * const d;
0052 protected:
0053 
0054     // Restrict who can make us
0055     friend class KoRdfSemanticItem;
0056     friend class KoRdfSemanticItemViewSite;
0057 
0058     KoSemanticStylesheet(const QString &uuid, const QString &name, const QString &templateString,
0059                          const QString &type = "System", bool isMutable = false);
0060 
0061     /**
0062      * Only called from KoRdfSemanticItemViewSite, this method actually
0063      * applies the stylesheet to a specific reference to a semantic
0064      * item in the document.
0065      */
0066     void format(hKoRdfSemanticItem obj, KoTextEditor *editor, const QString& xmlid = QString());
0067 
0068 public:
0069     ~KoSemanticStylesheet();
0070     static QString stylesheetTypeSystem();
0071     static QString stylesheetTypeUser();
0072 
0073     QString uuid() const;
0074     QString name() const;
0075     QString templateString() const;
0076     QString type() const;
0077     bool isMutable() const;
0078 
0079     // if (isMutable()) these methods update
0080     // user stylesheets are mutable, system ones are not
0081     void name(const QString &v);
0082     void templateString(const QString &v);
0083 
0084 Q_SIGNALS:
0085     void nameChanging(hKoSemanticStylesheet, const QString &oldName, const QString &newName);
0086 };
0087 
0088 #include <QMetaType>
0089 Q_DECLARE_METATYPE(KoSemanticStylesheet*)
0090 #endif