Warning, file /office/calligra/libs/rdf/KoRdfSemanticItemFactoryBase.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 Calligra project, made with-in the KDE community
0002 
0003    Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
0004    Copyright (C) 2013 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License as published by the Free Software Foundation; either
0009    version 2.1 of the License, or (at your option) any later version.
0010 
0011    This library is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014    Library General Public License for more details.
0015 
0016    You should have received a copy of the GNU Library General Public License
0017    along with this library; see the file COPYING.LIB.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019    Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #ifndef KORDFSEMANTICITEMFACTORYBASE_H
0023 #define KORDFSEMANTICITEMFACTORYBASE_H
0024 
0025 #include <kordf_export.h>
0026 
0027 // Calligra
0028 #include <KoRdfSemanticItem.h>
0029 
0030 // Qt
0031 #include <QString>
0032 
0033 class QMimeData;
0034 
0035 /**
0036  * A factory for semantic item objects. There should be one for each semantic item class to
0037  * allow the creation of such items from that plugin.
0038  * @see KoRdfSemanticItemRegistry
0039  */
0040 class KORDF_EXPORT KoRdfSemanticItemFactoryBase
0041 {
0042 public:
0043     /**
0044      * Create the new factory
0045      * @param parent the parent QObject for memory management usage.
0046      * @param id a string that will be used internally for referencing the semantic item type.
0047      */
0048     explicit KoRdfSemanticItemFactoryBase(const QString &id);
0049     virtual ~KoRdfSemanticItemFactoryBase();
0050 
0051 public: // API required by KoGenericRegistry
0052     /**
0053      * return the id for the semantic item this factory creates.
0054      * @return the id for the semantic item this factory creates.
0055      */
0056     QString id() const;
0057 
0058 public: // API to be implemented
0059     /**
0060      * Returns the name of the class of semantic items this factory creates.
0061      */
0062     virtual QString className() const = 0;
0063 
0064     /**
0065      * Returns the display name of the class of semantic items this factory creates.
0066      */
0067     virtual QString classDisplayName() const = 0;
0068 
0069     virtual void updateSemanticItems(QList<hKoRdfBasicSemanticItem> &semanticItems, const KoDocumentRdf *rdf, QSharedPointer<Soprano::Model> m) = 0;
0070 
0071     /**
0072      * Create a new instance of a semantic item.
0073      */
0074     virtual hKoRdfBasicSemanticItem createSemanticItem(const KoDocumentRdf *rdf, QObject *parent) = 0;
0075 
0076     /**
0077      * Returns if a semantic item could be principally created from the passed mimeData.
0078      * Creation could still fail if actually tried.
0079      */
0080     virtual bool canCreateSemanticItemFromMimeData(const QMimeData *mimeData) const = 0;
0081 
0082     /**
0083      * Create a new instance of a semantic item from the passed mimeData. Returns 0 if that fails.
0084      */
0085     virtual hKoRdfBasicSemanticItem createSemanticItemFromMimeData(const QMimeData* mimeData, KoCanvasBase *host,
0086                                                                    const KoDocumentRdf *rdf, QObject *parent = 0) const = 0;
0087 
0088     virtual bool isBasic() const = 0;
0089 private:
0090     class Private;
0091     Private * const d;
0092 };
0093 
0094 #endif