Warning, file /office/calligra/libs/text/KoDocumentRdfBase.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 KO_DOCUMENT_Rdf_Base_H
0021 #define KO_DOCUMENT_Rdf_Base_H
0022 
0023 #include "kotext_export.h"
0024 
0025 #include <QObject>
0026 #include <QMap>
0027 #include <QString>
0028 #include <QMetaType>
0029 #include <QSharedPointer>
0030 
0031 #include <KoDataCenterBase.h>
0032 
0033 class KoDocumentResourceManager;
0034 class QTextDocument;
0035 class KoStore;
0036 class KoXmlWriter;
0037 
0038 
0039 ///**
0040 // * Dummy definition in case Soprano is not available.
0041 // */
0042 namespace Soprano
0043 {
0044     class Model;
0045 }
0046 
0047 /**
0048  * A base class that provides the interface to many RDF features
0049  * but will not do anything if Soprano support is not built.
0050  * By having this "Base" class, code can call methods at points
0051  * where RDF handling is desired and can avoid \#ifdef conditionals
0052  * because the base class interface is here and will be valid, even
0053  * if impotent when Soprano support is not built.
0054  */
0055 class KOTEXT_EXPORT KoDocumentRdfBase : public QObject, public KoDataCenterBase
0056 {
0057     Q_OBJECT
0058 
0059 public:
0060     explicit KoDocumentRdfBase(QObject *parent = 0);
0061     ~KoDocumentRdfBase() override;
0062 
0063     /**
0064      * Get the Soprano::Model that contains all the Rdf
0065      * You do not own the model, do not delete it.
0066      */
0067 #ifdef SHOULD_BUILD_RDF
0068     virtual QSharedPointer<Soprano::Model> model() const;
0069 #endif
0070     virtual void linkToResourceManager(KoDocumentResourceManager *rm);
0071 
0072     virtual void updateInlineRdfStatements(const QTextDocument *qdoc);
0073     virtual void updateXmlIdReferences(const QMap<QString, QString> &m);
0074 
0075     /**
0076      * idrefList queries soprano after loading and creates a list of all rdfid's that
0077      * where found in the manifest.rdf document. This list is used to make sure we do not
0078      * create more inline rdf objects than necessary
0079      * @return a list of xml-id's
0080      */
0081     virtual QStringList idrefList() const;
0082 
0083 
0084     virtual bool loadOasis(KoStore *store);
0085     virtual bool saveOasis(KoStore *store, KoXmlWriter *manifestWriter);
0086 
0087     // reimplemented in komain/rdf/KoDocumentRdf
0088     bool completeLoading(KoStore *store) override;
0089     bool completeSaving(KoStore *store, KoXmlWriter *manifestWriter, KoShapeSavingContext *context) override;
0090 };
0091 
0092 Q_DECLARE_METATYPE(KoDocumentRdfBase*)
0093 
0094 #endif
0095