Warning, file /office/calligra/libs/main/KoDocumentEntry.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 2007 David Faure <faure@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 __ko_document_entry_h__ 0022 #define __ko_document_entry_h__ 0023 0024 #include <QList> 0025 #include <QString> 0026 #include <QSharedPointer> 0027 #include <QPluginLoader> 0028 0029 #include "komain_export.h" 0030 0031 class QStringList; 0032 class KoDocument; 0033 class KoPart; 0034 0035 /** 0036 * Represents an available Calligra component 0037 * that supports the document interface. 0038 */ 0039 class KOMAIN_EXPORT KoDocumentEntry 0040 { 0041 0042 public: 0043 /** 0044 * Represents an invalid entry (as returned by queryByMimeType for instance) 0045 */ 0046 explicit KoDocumentEntry(); 0047 /** 0048 * Represents a valid entry 0049 * @param loader pluginloader for the service, KoDocumentEntry takes ownership 0050 */ 0051 explicit KoDocumentEntry(QPluginLoader *loader); 0052 ~KoDocumentEntry(); 0053 0054 QJsonObject metaData() const; 0055 0056 QString fileName() const; 0057 0058 /** 0059 * @return TRUE if the service pointer is null 0060 */ 0061 bool isEmpty() const; 0062 0063 /** 0064 * @return name of the associated service 0065 */ 0066 QString name() const; 0067 0068 /** 0069 * Mimetypes (and other service types) which this document can handle. 0070 */ 0071 QStringList mimeTypes() const; 0072 0073 /** 0074 * @return TRUE if the document can handle the requested mimetype. 0075 */ 0076 bool supportsMimeType(const QString & _mimetype) const; 0077 0078 /** 0079 * Uses the factory of the component to create 0080 * a part. If that is not possible, 0 is returned. 0081 */ 0082 KoPart *createKoPart(QString* errorMsg = 0) const; 0083 0084 /** 0085 * This function will query ksycoca to find all available components for the requested mimetype. 0086 * The result will only contain parts, which are embeddable into a document 0087 * 0088 * @param mimetype is the MIME type expression as used by KTrader. 0089 * You can use it to set additional restrictions on the available 0090 * components. 0091 */ 0092 static QList<KoDocumentEntry> query(const QString & mimetype = QString()); 0093 0094 /** 0095 * This is a convenience function. 0096 * 0097 * @return a document entry for the Calligra component that supports 0098 * the requested mimetype and fits the user best. 0099 */ 0100 static KoDocumentEntry queryByMimeType(const QString & mimetype); 0101 0102 private: 0103 QSharedPointer<QPluginLoader> m_loader; 0104 }; 0105 0106 #endif